python - Selenium webdriver without any Desktop browser -



python - Selenium webdriver without any Desktop browser -

i using selenium. have next code:

from selenium import webdriver selenium.common.exceptions import nosuchelementexception selenium.webdriver.common.keys import keys browser = webdriver.firefox() browser.get("http://www.mysite.com") x = browser.find_elements_by_xpath("//div[@id='containeriso3']/div/a[1]") hrefs = [i.get_attribute('href') in x]

now, works.

but want on server runs on ubuntu command line. means cannot utilize this

browser = webdriver.firefox()

in code. alternative can used through command line?

you can utilize htmlunitdriver headless browser based on rhino javascript engine.

http://code.google.com/p/selenium/wiki/htmlunitdriver

python selenium command-line selenium-webdriver htmlunit

Comments

Popular posts from this blog

web services - java.lang.NoClassDefFoundError: Could not initialize class net.sf.cglib.proxy.Enhancer -

Accessing MATLAB's unicode strings from C -

javascript - mongodb won't find my schema method in nested container -