NoSuchElementException XPATH
quantumalchemy opened this issue · comments
Love this project! .. scraping OP is like the holy grail of scraping!
Its a cat and mouse game.. OP always changing their dom
-- will see if I can find ..
-->
selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="user-header-oddsformat-expander"]"}
thanks for the hardwork!
I got thiss error. Any help?
Data will be saved in the following directory: D:\Projects\scrapeOP
We start to collect season 2020-2021
We start to scrape the page n°1
DevTools listening on ws://127.0.0.1:52375/devtools/browser/0a773f49-71a0-49cf-8e07-f7727c9a49b5
Traceback (most recent call last):
File "d:\Projects\scrapeOP\scrapeOP\FinalScraper.py", line 13, in
scrape_oddsportal_historical(sport = 'soccer', country = 'france', league = 'ligue-1', start_season = '2020-2021', nseasons = 1, current_season = 'no', max_page = 1)
File "d:\Projects\scrapeOP\scrapeOP\functions.py", line 1615, in scrape_oddsportal_historical
df = scrape_league_typeC(Season=start_season, sport=sport, country1=country,
File "d:\Projects\scrapeOP\scrapeOP\functions.py", line 1106, in scrape_league_typeC
scrape_current_tournament_typeC(
File "d:\Projects\scrapeOP\scrapeOP\functions.py", line 989, in scrape_current_tournament_typeC
data = scrape_page_typeC(page, sport, country, tournament, SEASON)
File "d:\Projects\scrapeOP\scrapeOP\functions.py", line 946, in scrape_page_typeC
content = get_data_typeC(i, link)
File "d:\Projects\scrapeOP\scrapeOP\functions.py", line 815, in get_data_typeC
reject_ads()
File "d:\Projects\scrapeOP\scrapeOP\functions.py", line 1716, in reject_ads
driver.find_element("xpath", '//*[@id="app"]/div/header/div[2]/div[1]/div/button').click()
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webelement.py", line 94, in click
self._execute(Command.CLICK_ELEMENT)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webelement.py", line 404, in _execute
return self._parent.execute(command, params)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 440, in execute
self.error_handler.check_response(response)
File "C:\Users\Admin\AppData\Local\Programs\Python\Python310\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 245, in check_response raise exception_class(message, screen, stacktrace)
selenium.common.exceptions.ElementNotInteractableException: Message: element not interactable
(Session info: chrome=111.0.5563.147)
Stacktrace:
Backtrace:
(No symbol) [0x00F8DCE3]
(No symbol) [0x00F239D1]
(No symbol) [0x00E34C70]
(No symbol) [0x00E610D6]
(No symbol) [0x00E58D05]
(No symbol) [0x00E7AECC]
(No symbol) [0x00E58726]
(No symbol) [0x00E7B224]
(No symbol) [0x00E8D57C]
(No symbol) [0x00E7ACC6]
(No symbol) [0x00E56F68]
(No symbol) [0x00E580CD]
GetHandleVerifier [0x01203832+2506274]
GetHandleVerifier [0x01239794+2727300]
GetHandleVerifier [0x0123E36C+2746716]
GetHandleVerifier [0x01036690+617600]
(No symbol) [0x00F2C712]
(No symbol) [0x00F31FF8]
(No symbol) [0x00F320DB]
(No symbol) [0x00F3C63B]
BaseThreadInitThunk [0x762500F9+25]
RtlGetAppContainerNamedObjectPath [0x77377BBE+286]
RtlGetAppContainerNamedObjectPath [0x77377B8E+238]
I did get an error at this part too so i did just try to comment it out.
#def reject_ads(switch_to_decimal = True):
#Reject ads
#ffi2('//[@id="onetrust-reject-all-handler"]')
#if switch_to_decimal:
#Change odds to decimal format
#driver.find_element("xpath", '//[@id="user-header-oddsformat-expander"]').click()
#driver.find_element("xpath", '//*[@id="user-header-oddsformat"]/li[1]/a/span').click()
There is reject_ads in some of the def witch i also just did comment out.
Let me know if it helps you :)