Closed srichards2103 closed 11 months ago
@srichards2103 uhm yep, I'm aware of this bug & it should be fixed in the next release. However, I don't get it EVERY TIME.
dev
branch version fixes this (see Readme.md for installation)I've done a bit more testing. Seems that its more a problem with calculating x,y coordinates of the button after scrolling. My code hangs on this:
await price_element.click()
File "/Users/srichards/.pyenv/versions/3.11.1/lib/python3.11/site-packages/selenium_driverless/types/webelement.py", line 305, in click
x, y = await self.mid_location(bias=bias, resolution=resolution, debug=debug)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/srichards/.pyenv/versions/3.11.1/lib/python3.11/site-packages/selenium_driverless/types/webelement.py", line 376, in mid_location
res = await self.__target__.execute_cdp_cmd("DOM.getNodeForLocation", {"x": x, "y": y,
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/srichards/.pyenv/versions/3.11.1/lib/python3.11/site-packages/selenium_driverless/types/target.py", line 722, in execute_cdp_cmd
result = await self.socket.exec(method=cmd, params=cmd_args, timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/srichards/.pyenv/versions/3.11.1/lib/python3.11/site-packages/cdp_socket/socket.py", line 69, in exec
return await asyncio.wait_for(self._responses[_id], timeout=timeout)
^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
File "/Users/srichards/.pyenv/versions/3.11.1/lib/python3.11/asyncio/tasks.py", line 466, in wait_for
await waiter
This is with the dev branch.
Wait a minute the line await self.__target__.execute_cdp_cmd("DOM.getNodeForLocation", {"x": x, "y": y,
raises No node with given id found
? That doesn't make any sense to me lol.
@srichards2103 btw, could you provide an example script where you get that error with?
And also, I think your traceback is missing some lines?
Yeah its a different bug altogether. For some reason when loading the url on the browser without a new tab I would instantly get the No node with given id found
error. But then when I switched to create a new page this went away.
The problem seems to be with finding the x,y coordinates of elements which are out of view before clicking. There's nothing else in the traceback which helps and not sure if providing a script would help reproduce since the website may be blocked for you if you aren't in Australia, it just seems to hang on the await self.__target__.execute_cdp_cmd("DOM.getNodeForLocation", {"x": x, "y": y
I've watched the browser, works perfectly when the element is within view, then if the browser needs to scroll it hangs.
@srichards2103 Ohh now I get it, probably another bug in Google-Chrome
-_-
I'll just put x, y = await self.mid_location
after scrolling to the element then for now:)
Thanks a lot!
Yeah just tested, seems to work! Thanks alot
@srichards2103
This should be resolved with selenium-driverless==1.6
Please close this issue if it's fixed now:)
I've found that whenever my code needs to scroll to an element in order to click it this error appears. Simply with
await pe.click()
Let me know if there's anything else I need to add