Skip to content

Instantly share code, notes, and snippets.

@nithyadurai87
Last active May 26, 2016 17:25
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save nithyadurai87/99827ac397733358d81334ca72b327d4 to your computer and use it in GitHub Desktop.
Save nithyadurai87/99827ac397733358d81334ca72b327d4 to your computer and use it in GitHub Desktop.
from selenium import webdriver
a = webdriver.Firefox()
a.get("http://magento-demo.lexiconn.com/")
a.maximize_window()
a.find_element_by_xpath("//input[@id='search']").send_keys("Bed & Bath")
a.find_element_by_xpath("//button[@title='Search']").click()
lis = a.find_elements_by_xpath("//h2[@class='product-name'] / a ")
print str(len(lis)) + " products found"
for i in lis:
print i.text
a.quit()
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment