I'm trying to click the play button on amazon photos using selenium in a python script. I've tried using a xpath
play_button_displayed = driver.find_element(By.XPATH,'//*[@id="photos"]/section/section/section/div/div/figure[1]/div/div[1]/figure/figure/button')
play_button_display.click()
i've tried other methods and the most promising in my eyes was the css selector `
play_button = driver.find_element(By.CSS_SELECTOR,".play")
play_button.click()
Traceback (most recent call last):
File "d:\pictures_backup\tool_used\python\amazon_photos_web_list_creation\amazon_photos_open_and_replace_date_auto_and_manual\amazon_photos_open_and_replace_date_auto_and_manual.py", line 104, in <module>
LaunchBrowser_main()
File "d:\pictures_backup\tool_used\python\amazon_photos_web_list_creation\amazon_photos_open_and_replace_date_auto_and_manual\amazon_photos_open_and_replace_date_auto_and_manual.py", line 53, in LaunchBrowser_main
click_info()
File "d:\pictures_backup\tool_used\python\amazon_photos_web_list_creation\amazon_photos_open_and_replace_date_auto_and_manual\amazon_photos_open_and_replace_date_auto_and_manual.py", line 92, in click_info
play_button = driver.find_element(By.CSS_SELECTOR,"play")
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\remote\webdriver.py", line 830, in find_element
return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})["value"]
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "C:\Users\Eric\AppData\Local\Packages\PythonSoftwareFoundation.Python.3.11_qbz5n2kfra8p0\LocalCache\local-packages\Python311\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response
raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"play"}
(Session info: chrome=110.0.5481.78)
Stacktrace:
Backtrace:
(No symbol) [0x007C37D3]
(No symbol) [0x00758B81]
(No symbol) [0x0065B36D]
(No symbol) [0x0068D382]
(No symbol) [0x0068D4BB]
(No symbol) [0x006C3302]
(No symbol) [0x006AB464]
(No symbol) [0x006C1215]
(No symbol) [0x006AB216]
(No symbol) [0x00680D97]
(No symbol) [0x0068253D]
GetHandleVerifier [0x00A3ABF2+2510930]
GetHandleVerifier [0x00A68EC1+2700065]
GetHandleVerifier [0x00A6C86C+2714828]
GetHandleVerifier [0x00873480+645344]
(No symbol) [0x00760FD2]
(No symbol) [0x00766C68]
(No symbol) [0x00766D4B]
(No symbol) [0x00770D6B]
BaseThreadInitThunk [0x761E00F9+25]
RtlGetAppContainerNamedObjectPath [0x77607BBE+286]
RtlGetAppContainerNamedObjectPath [0x77607B8E+238]
[Done] exited with code=1 in 32.94 seconds
but that didn't work either. i would like to preferable work in css selector since that seems the easiest. any help will be much appreciated.
here's the xpath of buttom from chrome
//*[@id="photos"]/section/section/section/div/div/figure[1]/div/div[1]/figure/figure/button
full xpath
/html/body/div[1]/div/div[2]/section/section/section/div/div/figure[1]/div/div[1]/figure/figure/button
and element
<button class="play"></button>
i've tried, xpath, css selector, class name id ect and they all didn't work but css selector seems the easiest and promising but thats not working lmao