Reputation: 355
I am using Powershell with Selenium and need to select an item from a drop down. The page is https://app.beefy.finance/ . I need to change "Vault Type" from "ALL" to "Single assets"
$browser = Start-SeChrome
$URL = "https://app.beefy.finance/"
$browser.Navigate().GoToURL($URL)
#----- Wait statements here ------
$Select_Option = $browser.FindElementById("select-vault-type")
#At this stage I have tried the following commands but they all error out:
Set-SeSelectValue -By Value -value 'Single Assets' -Element $Select_Option
$Select_Option.SelectByValue('Single Assets')
$Select_Option.Text('Single Assets')
I have even tried using xpath but that fails as well
Upvotes: 0
Views: 671
Reputation: 526
You need to click on the drop down for the object to appear. Then you can find it and click on it. i used it's XPath:
$browser = Start-SeChrome
$URL = "https://app.beefy.finance/"
$browser.Navigate().GoToURL($URL)
#----- Wait statements here ------
$Select_Option = $browser.FindElementById("select-vault-type")
$Select_Option.Click()
$Select_Option.FindElementByXPath('/html/body/div[4]/div[3]/ul/li[2]').Click()
Upvotes: 1