Selenium WebDriver, using Chrome and Powershell. I'm trying to choose and click the 'en' value, from the drop down of the language menu.
Here is the HTML Code:
<select id="language_select" name="language_select" class="form-control" onchange="ls.change();">
<option value="en" title="English">English</option>
<option value="fr" title="French">French</option>
</select>
Using java, that code will be as follow:
WebElement langmenu = driver.findElement(By.id("language_select"));
Select selectMonth = new Select(langmenu);
selectMonth.selectByVisibleText("en");
But I'm struggling to accomplish the same using Powershell, So far, I've manage to understand how to search by Id and store it in a variable, using Powershell:
$ChromeDriver = New-Object -TypeName OpenQA.Selenium.Chrome.ChromeDriver
$ChromeDriver.Navigate().GoToURL('https://myserver/login/')
$langmenu = $ChromeDriver.FindElementById("language_select")
But I don't understand how to create a new select object, and choose the 'en' value, so I can use the selectByVisibleText
or selectByIndex
methods on the the select object.