I use Python Beautiful Soup to move through DOM elements and Selenium to open page in chrome and ActionChains to scroll in page. It worked fine but the website changed something and now I run into two kinds of error on the way it worked before and on a new way as a possible solution.
Old solution:
submit_button = driver.find_element_by_name('quantity') elementList = submit_button.find_elements_by_tag_name("option") elementList[int(column)-1].click() Old Error:
Traceback (most recent call last): File "C:/Users/Felix_P/PycharmProjects/Price_Tool/Combination_14_6_2016.py", line 205, in <module> elementList[int(column)-1].click() File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 75, in click self._execute(Command.CLICK_ELEMENT) File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\webelement.py", line 469, in _execute return self._parent.execute(command, params) File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute self.error_handler.check_response(response) File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.ElementNotVisibleException: Message: element not visible: Element is not currently visible and may not be manipulated (Session info: chrome=51.0.2704.103) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64) New Solution:
submit_button = driver.find_element_by_name('quantity') elementList = submit_button.find_elements_by_tag_name("option") actions.move_to_element(elementList[int(column)-1]).click().perform() New Error:
Traceback (most recent call last): File "C:/Users/Felix_P/PycharmProjects/Price_Tool/Combination_14_6_2016.py", line 201, in <module> actions.move_to_element(elementList[int(column)-1]).click().perform() File "C:\Python35-32\lib\site-packages\selenium\webdriver\common\action_chains.py", line 72, in perform action() File "C:\Python35-32\lib\site-packages\selenium\webdriver\common\action_chains.py", line 217, in <lambda> self._driver.execute(Command.MOVE_TO, {'element': to_element.id})) File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 201, in execute self.error_handler.check_response(response) File "C:\Python35-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 193, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.StaleElementReferenceException: Message: stale element reference: element is not attached to the page document (Session info: chrome=51.0.2704.103) (Driver info: chromedriver=2.21.371459 (36d3d07f660ff2bc1bf28a75d1cdabed0983e7c4),platform=Windows NT 6.1 SP1 x86_64)