有没有人用ChromeDriver打开Chrome的新标签?
使用这段代码,我可以在Chrome中打开我的index.html:
driver = webdriver.Chrome("/usr/bin/chromedriver")
driver.get("localhost:3000")然后我想在一个新的选项卡中打开localhost:3000/cloudPeer.html:
driver.find_element_by_tag_name("body").send_keys(Keys.CONTROL + 't')
driver.get("localhost:3000/cloudPeer.html")这在Firefox中很好,但是在Chrome中,它不能打开一个新的选项卡,它只会刷新第一页,打开新页,第一页现在就丢失了。
我想同时打开这两个页面,并在它们之间做一些通信测试。
发布于 2016-02-06 04:26:58
这适用于铬-
driver.execute_script("window.open('https://www.google.com');")https://stackoverflow.com/questions/35208342
复制相似问题