python - Selenium phantomjs webdriver hangs on click -
i trying navigate through pages clicking next button. works first 2 3 pages, after hangs while clicking.
from selenium import webdriver selenium.webdriver.common.desired_capabilities import desiredcapabilities import time dcap = dict(desiredcapabilities.phantomjs) dcap["phantomjs.page.settings.useragent"] = ('mozilla/5.0 (windows nt 6.3; win64; x64) applewebkit/537.36 (khtml, gecko) chrome/53.0.2785.89 safari/537.36') driver = webdriver.phantomjs("path phantomjs",desired_capabilities=dcap) driver.get("http://www.zappos.com/product/review/7391917/page/1/start/5") print driver.current_url in range(5): print driver.find_element_by_css_selector("p[class='top-pagination'] a[class*='next']").click() time.sleep(3) print driver.current_url
the following output shows click happens first few pages , resulting url change. hangs after first few clicks indefinitely.
http://www.zappos.com/product/review/7391917/page/1/start/5 0 http://www.zappos.com/product/review/7391917/page/2/start/5 1 http://www.zappos.com/product/review/7391917/page/3/start/5 2
any idea on why happens ?
Comments
Post a Comment