Guest User

Untitled

a guest
Dec 21st, 2017
119
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 2.71 KB | None | 0 0
  1. #need some of the libraries for later code
  2. from bs4 import BeautifulSoup as soup
  3. import requests
  4. import sys
  5. import re
  6. from selenium import webdriver
  7. from selenium.webdriver.common.keys import Keys
  8. from selenium.webdriver.chrome.options import Options
  9. from selenium.webdriver.common.by import By
  10. from selenium.webdriver.support.ui import WebDriverWait
  11. from selenium.webdriver.support import expected_conditions as EC
  12.  
  13. input("If ready press 'enter'")
  14.  
  15. loginurl = 'https://www.willhaben.at/iad/?islogout=true&logoff.y=10'
  16.  
  17. chrome_options = Options()
  18. chrome_options.add_argument('disable-infobars')
  19. driver = webdriver.Chrome(executable_path="C:\Users\laure\Downloads\chromedriver_win32\chromedriver.exe", chrome_options=chrome_options, service_args=['--ignore-ssl-errors=true', '--ssl-protocol=any'])
  20.  
  21.  
  22. USERNAME = 'notgonnagiveit :)'
  23. PASSWORD = 'notgonnagiveit'
  24.  
  25. driver.get(loginurl)
  26.  
  27. element = WebDriverWait(driver, 10).until(
  28. EC.presence_of_element_located((By.XPATH, '//*[@id="username"]'))
  29. )
  30.  
  31. username = driver.find_element_by_xpath('//input[@id="username"]')
  32. password = driver.find_element_by_xpath('//input[@id="password"]')
  33.  
  34. password.send_keys(PASSWORD)
  35. username.send_keys(USERNAME)
  36.  
  37. driver.get("https://www.willhaben.at/iad/myprofile/adadministration/showlist?page=6")
  38. editbutton = driver.find_element_by_xpath("//input[@class='btn icon-icon_bearbeiten status-expired'][@type='button']")
  39. editbutton.click()
  40.  
  41. driver.quit()
  42.  
  43. Traceback (most recent call last):
  44. File "D:OneDriveDokumenteWillhabenWillhaben.py", line 84, in <module>
  45. editbutton = driver.find_element_by_xpath("//input[@class='btn icon-icon_bearbeiten status-expired'][@type='button']")
  46. File "C:UserslaureAppDataLocalProgramsPythonPython35libsite-packagesseleniumwebdriverremotewebdriver.py", line 368, in find_element_by_xpath
  47. return self.find_element(by=By.XPATH, value=xpath)
  48. File "C:UserslaureAppDataLocalProgramsPythonPython35libsite-packagesseleniumwebdriverremotewebdriver.py", line 858, in find_element
  49. 'value': value})['value']
  50. File "C:UserslaureAppDataLocalProgramsPythonPython35libsite-packagesseleniumwebdriverremotewebdriver.py", line 311, in execute
  51. self.error_handler.check_response(response)
  52. File "C:UserslaureAppDataLocalProgramsPythonPython35libsite-packagesseleniumwebdriverremoteerrorhandler.py", line 237, in check_response
  53. raise exception_class(message, screen, stacktrace)
  54. selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//input[@class='btn icon-icon_bearbeiten status-expired'][@type='button']"}
  55. (Session info: chrome=63.0.3239.84)
  56. (Driver info: chromedriver=2.34.522940 (1a76f96f66e3ca7b8e57d503b4dd3bccfba87af1),platform=Windows NT 10.0.16299 x86_64)
Add Comment
Please, Sign In to add comment