Python Selenium Firefox on Ubuntu: New Tabs Not Working -
i'm doing remote web crawling , scraping, , hoping not reload new browser window every link on 1 page.
the problem new tabs not opening firefox web driver.
here's i've tried:
from selenium import webdriver selenium.webdriver.common.keys import keys selenium.webdriver.common.action_chains import actionchains pyvirtualdisplay import display # launch our headless display display = display(visible=0, size=(800, 600)) display.start() # launch our web driver , page browser = webdriver.firefox() browser.get("http://www.google.com/") # try open new tab actionchains(browser).key_down(keys.control).send_keys("t").key_up(keys.control).perform() # should print 2, prints 1, because new tab not opened print len(browser.window_handles) # clean browser.quit() display.stop()
specifications:
- ubuntu 14.04.2
- python 2.7.6
- selenium 2.47.1
- pyvirtualdisplay 0.1.3
based on this response selenium developer, new tabs in firefox not supported of august 2015. suggested exploring marionette dependencies cause more trouble it's worth, @ least use case. solution use new windows (driver.execute_script("window.open()")
), instead of new tabs.
Comments
Post a Comment