I am using selenium. I have the following code:
from selenium import webdriver
from selenium.common.exceptions import NoSuchElementException
from 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') for i in x]
Now, this works.
But I want to do this is on a server which runs on ubuntu command line. This means I cannot use this
browser = webdriver.Firefox()
in my code. What alternative can be used to this through command line?
You can use HtmlUnitDriver which is headless browser based on Rhino javascript engine.
http://code.google.com/p/selenium/wiki/HtmlUnitDriver