Reputation: 63
I've tried several functions but none seems to be working? For example:
element, _ := webdriver.FindElement(selenium.ByCSSSelector, "body")
element.SendKeys(selenium.ControlKey + "t")
Upvotes: 1
Views: 178
Reputation: 3753
Selenium is capable of executing javascript within the browser.
To open a new tab get selenium to run the following:
window.open()
I've not used Selenium & Go before - so I can't comment on the syntax. However it's normally along the lines of driver.ExecuteScript("window.open()")
. See if your IDE will help you plug the gap.
After you get a new tab, you typically need to use the .switchTo
in order to move selenium to another tab.
updated:
Docs suggest....
// ExecuteScript executes a script.
ExecuteScript(script string, args []interface{}) (interface{}, error)
see here
Upvotes: 2