daily pastebin goal
16%
SHARE
TWEET

Untitled

a guest Dec 2nd, 2015 61 Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
  1. driver.find_element_by_id("login-button").click()
  2. from selenium.common.exceptions import NoSuchElementException
  3. try:
  4.  
  5.     if (driver.find_element_by_link_text("welcome screen")): #<-- sometimes this elements appears randomly, i was to click on it when and if it appears
  6.         driver.find_element_by_link_text("welcome screen").click()
  7. except NoSuchElementException:
  8.         print "No welcome screen"
  9.            
  10. time.sleep(3)
  11. driver.find_element_by_link_text("Stacks").click()
  12.  
  13.  
  14.  
  15. ------------------------------
  16. ./check_stacks.py  
  17. Traceback (most recent call last):
  18.   File "./check_stacks.py ", line 44, in <module>
  19.     if (driver.find_element_by_link_text("welcome screen")):
  20.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 282, in find_element_by_link_text
  21.     return self.find_element(by=By.LINK_TEXT, value=link_text)
  22.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 712, in find_element
  23.     {'using': by, 'value': value})['value']
  24.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/webdriver.py", line 201, in execute
  25.     self.error_handler.check_response(response)
  26.   File "/Library/Python/2.7/site-packages/selenium/webdriver/remote/errorhandler.py", line 181, in check_response
  27.     raise exception_class(message, screen, stacktrace)
  28. selenium.common.exceptions.NoSuchElementException: Message: Unable to locate element: {"method":"link text","selector":"welcome screen"}
  29. Stacktrace:
  30.     at FirefoxDriver.prototype.findElementInternal_ (file:///var/folders/d6/gmdplmmx69502yrdlq4lfvtw0000gn/T/tmpmajndq/extensions/fxdriver@googlecode.com/components/driver-component.js:10659)
  31.     at fxdriver.Timer.prototype.setTimeout/<.notify (file:///var/folders/d6/gmdplmmx69502yrdlq4lfvtw0000gn/T/tmpmajndq/extensions/fxdriver@googlecode.com/components/driver-component.js:621)
RAW Paste Data
We use cookies for various purposes including analytics. By continuing to use Pastebin, you agree to our use of cookies as described in the Cookies Policy. OK, I Understand
 
Top