Select an option from the drop-down list to automate ui testing in Windows powershell

Sorry if this is too easy, but I'm pretty new to Windows Powershell, and all the tutorials I've looked at dropdowns show you how to display them to the user.

Anyway, what I'm trying to do is check out my web application using Powershell. I need to change the drop-down list to a specific choice, I can use the value or index to do this, it does not matter to me.

Thanks for any help you can give.

+4
source share
2 answers

It turned out that the easiest way to do this is to simply set the value of the control to the index that I need:

$ie = new-object -com "InternetExplorer.Application" $ie.navigate("mywebsite") $ie.visible = $true $doc = $ie.document $listbox = $doc.getElementByID(listboxID) $listbox.value = 1 

This selects the first value in the list. I do not know how to say what this meaning is, if you still do not know it. Or choose based on text, but I don't need it.

+4
source

How about using WatiN from PowerShell ?

0
source

Source: https://habr.com/ru/post/1344620/


All Articles