binance-trading-bot-new-coins icon indicating copy to clipboard operation
binance-trading-bot-new-coins copied to clipboard

Unable to locate element: {"method":"css selector","selector":"[id="link-0-0-p1"]"}

Open DenRui opened this issue 2 years ago • 3 comments

Hi. How can I solve the following, copied the response in full: xception in thread Thread-2 (search_and_update): Traceback (most recent call last): File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 1009, in _bootstrap_inner self.run() File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/threading.py", line 946, in run self._target(*self._args, **self._kwargs) File "/Users/dennis/new_listings_scraper.py", line 73, in search_and_update latest_coin = get_last_coin() File "/Users/dennis/new_listings_scraper.py", line 27, in get_last_coin latest_announcement = driver.find_element(By.ID, 'link-0-0-p1') File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 1251, in find_element return self.execute(Command.FIND_ELEMENT, { File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py", line 430, in execute self.error_handler.check_response(response) File "/Library/Frameworks/Python.framework/Versions/3.10/lib/python3.10/site-packages/selenium/webdriver/remote/errorhandler.py", line 247, 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":"[id="link-0-0-p1"]"}

DenRui avatar Jun 18 '22 06:06 DenRui

I have the same issue, any updates on that?

pdb159 avatar Jul 07 '22 09:07 pdb159

in the new_listings_scraper.py

#latest_announcement = driver.find_element(By.ID, 'link-0-0-p1')
latest_announcement = WebDriverWait(driver,100).until(EC.presence_of_element_located((By.ID, 'link-0-0-p1')))

seems to kinda work?

you also need to add from selenium.webdriver.support.ui import WebDriverWait from selenium.webdriver.common.by import By from selenium.webdriver.support import expected_conditions as EC https://stackoverflow.com/questions/45500606/set-chrome-browser-binary-through-chromedriver-in-python

midhatn avatar Aug 20 '22 09:08 midhatn

Hi @midhatn

I tried your snippet, still not working. Now i receive a selenium timeout exception error. Hence i assume that the ID 'link-0-0-p1' does not exist or has a different name, do you have any idea to where it is referring? In my opinion it should grab the first item of the binance new listings page, but when i inspect the html this object is not referred by ID

pdb159 avatar Aug 25 '22 10:08 pdb159