robintw / ParentZonePhotoDownloader

Downloads photos from a ParentZone account
5 stars 4 forks source link

Unable to locate element #4

Open krsecurity opened 3 years ago

krsecurity commented 3 years ago

Hi,

I'm getting the below issue - is it that the parentzone website has made changes?

Traceback (most recent call last): File "/root/ParentZonePhotoDownloader/./download_parentzone_photos.py", line 91, in get_parentzone_photos() File "/usr/lib/python3/dist-packages/click/core.py", line 829, in call return self.main(args, kwargs) File "/usr/lib/python3/dist-packages/click/core.py", line 782, in main rv = self.invoke(ctx) File "/usr/lib/python3/dist-packages/click/core.py", line 1066, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/lib/python3/dist-packages/click/core.py", line 610, in invoke return callback(args, *kwargs) File "/root/ParentZonePhotoDownloader/./download_parentzone_photos.py", line 29, in get_parentzone_photos email_field = driver.find_element_by_xpath('//[@id="login"]/fieldset/div[1]/input') File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 399, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 1012, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/webdriver.py", line 318, in execute self.error_handler.check_response(response) File "/usr/lib/python3/dist-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="login"]/fieldset/div[1]/input"} (Session info: chrome=91.0.4472.114)

djsjobo commented 3 years ago

Hi,

I am getting exactly the same issue:

Traceback (most recent call last): File "download_parentzone_photos.py", line 91, in get_parentzone_photos() File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(args, *kwargs) File "download_parentzone_photos.py", line 29, in get_parentzone_photos email_field = driver.find_element_by_xpath('//[@id="login"]/fieldset/div[1]/input') File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="login"]/fieldset/div[1]/input"} (Session info: chrome=92.0.4515.107)

robintw commented 3 years ago

I can't seem to reproduce this problem - the downloading script works fine for me.

Can you try again and see whether it was some sort of temporary change that ParentZone did? Alternatively, I guess ParentZone might be A/B testing something, and therefore you're getting a different site to me.

smaggioni commented 3 years ago

I'm getting the same issues here as well.

I run the script, Chrome opens up ParentZone but I just get the login page - should it be logging me in? Even if I quickly paste in credentials the script still errors out:

Traceback (most recent call last): File "download_parentzone_photos.py", line 91, in get_parentzone_photos() File "/.local/lib/python3.8/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/.local/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/.local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/.local/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(args, *kwargs) File "download_parentzone_photos.py", line 29, in get_parentzone_photos email_field = driver.find_element_by_xpath('//[@id="login"]/fieldset/div[1]/input') File "/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/.local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/.local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="login"]/ (Session info: chrome=92.0.4515.131)

robintw commented 3 years ago

Hmm that is strange - I definitely don't run into that problem.

I'll try clearing my caches and try ParentZone in incognito mode and see if I can reproduce then. I'm about to go away on holiday, but ping me in a while if I haven't responded.

krsecurity commented 3 years ago

If it helps anyone, I wrote a very crude way of grabbing the images here - https://github.com/krsecurity/ParentZoneImageGrabber

Just need to insert your API key which you can get by viewing the full size of any image on the website (or grabbing a request in something like Burpsuite).

markbchapman commented 3 years ago

I did some further investigation and think I have now got a bit further forward by changing the xpath variables for login and password to:

email_field = driver.find_element_by_xpath('//[@id="email"]') passwd_field = driver.find_element_by_xpath('//[@id="password"]')

however it still doesn't download the pictures, I suspect this is due to a change in timeline page, but it is beyond my limited programming skills to work out how to fix, the new error is:

Traceback (most recent call last): File "download_parentzone_photos.py", line 91, in get_parentzone_photos() File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(args, *kwargs) File "download_parentzone_photos.py", line 42, in get_parentzone_photos dropdown = Select(driver.find_element_by_xpath('//[@id="filter"]//select')) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="filter"]//select"} (Session info: chrome=92.0.4515.159)

I am seeing the same problem as well:

Traceback (most recent call last): File "download_parentzone_photos.py", line 91, in get_parentzone_photos() File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(args, *kwargs) File "download_parentzone_photos.py", line 29, in get_parentzone_photos email_field = driver.find_element_by_xpath('//[@id="login"]/fieldset/div[1]/input') File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="login"]/fieldset/div[1]/input"} (Session info: chrome=92.0.4515.159)

elmaestro78 commented 3 years ago

Hi @robintw, did you manage to recreate this issue? I have had the same result, any help much appreciated:

Traceback (most recent call last): File "c:/cygwin64/home/download_parentzone_photos.py", line 91, in get_parentzone_photos() File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1137, in call return self.main(args, kwargs) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1062, in main rv = self.invoke(ctx) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 1404, in invoke return ctx.invoke(self.callback, ctx.params) File "/usr/local/lib/python3.8/site-packages/click/core.py", line 763, in invoke return __callback(args, *kwargs) File "c:/cygwin64/home/download_parentzone_photos.py", line 29, in get_parentzone_photos email_field = driver.find_element_by_xpath('//[@id="login"]/fieldset/div[1]/input') File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 394, in find_element_by_xpath return self.find_element(by=By.XPATH, value=xpath) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 976, in find_element return self.execute(Command.FIND_ELEMENT, { File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/webdriver.py", line 321, in execute self.error_handler.check_response(response) File "/usr/local/lib/python3.8/site-packages/selenium/webdriver/remote/errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="login"]/fieldset/div[1]/input"} (Session info: chrome=93.0.4577.82)