I open a second tab with the command indicated below. With which command do I open a new link using the same tab?
driver.execute_script("window.open('www.example');")
I open a second tab with the command indicated below. With which command do I open a new link using the same tab?
driver.execute_script("window.open('www.example');")
Open a new tab as here and then verify than the correct link is opened How to open a new tab using Selenium WebDriver or here Open web in new tab Selenium + Python
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()
driver.get("http://stackoverflow.com/")
body = driver.find_element_by_tag_name("body")
body.send_keys(Keys.CONTROL + 't')
driver.close()
For asserting use:
assert driver.title == "Expected page title"