0

I am using selenium to open facebook then I sign in using my credentials and then I want to open a facebook page again. Sometimes it gets open and sometime its not. What could be the problem?

driver = webdriver.Firefox()
fburl = "https://www.facebook.com/"
driver.get(fburl)

assert "Facebook" in driver.title
elem = driver.find_element_by_id("email")
elem.send_keys("XXXX")
elem = driver.find_element_by_id("pass")
elem.send_keys("XXXX")
elem.send_keys(Keys.RETURN)

# open some fb page
for i in range(len(fbpagelist)):
   fbpageurl = fbpafelist[i]
   driver.get(fbpageurl)

I have to open a facebook page on the same browser with logged in Facebook.

Sometimes I can see fbpageurl on opened browser but sometimes not.

sau
  • 1,316
  • 4
  • 16
  • 37
  • What are the symptoms? Any errors? What is happening on the browser side? – alecxe Jun 03 '15 at 12:15
  • NO errors when I opened a new tab via python code. I can see new open tab. But its showing 'connecting' and cant see URL in address bar. – sau Jun 03 '15 at 12:21
  • What firefox and selenium versions are you using? – alecxe Jun 03 '15 at 12:22
  • Both I have updated to latest one.But sometimes Its working. Is there any time limit for browser opened by selenium. – sau Jun 03 '15 at 12:23
  • That could be a problem, downgrade firefox to 35.0.1 and check if the issue persists. See http://stackoverflow.com/questions/30456204/firefox-crash-when-i-run-sellenium-unit-test/30456251#30456251 and http://stackoverflow.com/questions/30473556/firefox-is-crash-when-start-by-selenium-firefox-driver. – alecxe Jun 03 '15 at 12:25
  • I think it depends on how fast can you log in, because after you press the RETURN, you instantly redirect to the fbpageurl. Try to insert a Thread.sleep(1000) or (2000) before the second driver.get(). – peetya Jun 03 '15 at 12:59
  • @peetya Yes I am using time.sleep(10) for now – sau Jun 03 '15 at 13:17
  • @alecxe I have downgraded my firefox version. Still facing the issue. I am opening a facebook then log in after that I have some 50 pages to check. So for 4-5 pages I can see its working but after that new tab just shows 'connecting' – sau Jun 03 '15 at 13:19
  • This code isn't enough to understand or see the issue. Please minimise it. – Arran Jun 03 '15 at 21:51

0 Answers0