T
T
TechNOIR2017-10-30 16:55:15
PowerShell
TechNOIR, 2017-10-30 16:55:15

Powershell+Selenium. How to open a new tab on click?

Good afternoon.
I click on an element:

$ie.FindElementsByXPath("//button[@class='styledbutton']").Click()

And after the click opens the content in the same tab. How to make it open in a new tab?
thanks in advance

Answer the question

In order to leave comments, you need to log in

2 answer(s)
A
azarij, 2017-10-30
@azarij

For chrome it worked for me like this:

$uri = "http://google.com"

add-type -path C:\test\selenium\net40\WebDriver.dll

$driver = New-Object OpenQA.Selenium.Chrome.ChromeDriver
$driver.url = $uri

$driver.FindElementByLinkText("Gaeilge").SendKeys([OpenQA.Selenium.Keys]::Control + [OpenQA.Selenium.Keys]::Enter)

I
IvanSstarr, 2019-02-11
@IvanSstarr

You can first get a link from the element you want to click on, and then substitute it here:
$ie.executeScript("window.open(' yandex.ru ', '_blank')")

Didn't find what you were looking for?

Ask your question

Ask a Question

731 491 924 answers to any question