Webview - How to read in values from a form

Ask your PowerShell-related questions, including questions on cmdlet development!
Forum rules
Do not post any licensing information in this forum.

Any code longer than three lines should be added as code using the 'Select Code' dropdown menu or attached as a file.
This topic is 9 months and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked
granttt
Posts: 3
Last visit: Mon Jun 12, 2023 6:52 pm

Webview - How to read in values from a form

Post by granttt »

Hi,

Running the latest PowerShell Studio 2023 version I can add a webview control correctly and browse a website.
https://www.sapien.com/blog/2022/02/14/ ... 2-control/

I can also set values on forms correctly. e.g. changing a textbox value to something else

I'm interested in reading from a form on a website's form values. e.g. working out the txtDescription

Example code for setting a value that works correctly:

Code: Select all

$webview.add_NavigationCompleted({

			$webview.ExecuteScriptAsync("document.getElementById('txtDescription').value = 'Set some value'")
})
I'm struggling to work out how I can read the value of "txtDescription".
Example html:

Code: Select all

<form>
<input id="txtDescription" name="txtDescription" type="text">
</form>
Anyone have any thoughts or suggestions?
granttt
Posts: 3
Last visit: Mon Jun 12, 2023 6:52 pm

Re: Webview - How to read in values from a form

Post by granttt »

This question on the forum can be closed as I've worked a way around it.
This topic is 9 months and 3 weeks old and has exceeded the time allowed for comments. Please begin a new topic or use the search feature to find a similar but newer topic.
Locked