Reputation: 13
I am using selenium and firefox webdriver for parsing a webpage. My selenium version is 2.42.1 and firefox version is 30.0 . After a couple of clicks on 'show-more-results' button, firefox hangs. My code is written below. What could be possible edits to prevent it from hanging.
from random import randint
from selenium import webdriver
import time
driver = webdriver.Firefox()
driver.get("http://www.flipkart.com/mobiles/pr?p%5B%5D=facets.price_range%255B%255D%3DRs.%2B2000%2Band%2BBelow&p%5B%5D=sort%3Dpopularity&sid=tyy%2C4io&ref=c3bdacf2-56b7-49d6-a8bc-91b95e6031bf")
for i in range(4):
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(4)
while True:
try:
driver.find_element_by_xpath('//*[@id="show-more-results"]')
try:
driver.execute_script("window.scrollTo(0, document.body.scrollHeight);")
time.sleep(4)
driver.find_element_by_xpath('//*[@id="show-more-results"]').click()
time.sleep(randint(7,9))
except Exception as e:
continue
except Exception as d:
break
Upvotes: 0
Views: 987
Reputation: 5405
I guess you've to uninstall the Skype addon/extension that is in the Firefox browser. Worked like a charm for me after I unistalled it. Try it.
Upvotes: 1