Ali-Hasan-Khan / Scrape-Whoscored-Event-Data

Get match event data from whoscored.com
MIT License
27 stars 8 forks source link

Issue with function main.getMatchUrls #5

Closed micheledeantoni closed 1 month ago

micheledeantoni commented 1 month ago

Dear Developers,

first of all I want to express my gratitude for making this package and making football data more available for everyone. Sadly, after some weeks of usage with no issues I get this error now with the function getMatchUrls:

I'm encountering a NoSuchElementException when attempting to locate an element via XPath in Selenium. This error occurs when I try to interact with elements on a dynamically loaded webpage. Here is the complete traceback and code snippet where the error occurs:

Thank you in advance,

Michele


---------------------------------------------------------------------------
NoSuchElementException                    Traceback (most recent call last)
File ~/code/micheledeantoni/FSPM/data/main.py:168, in getMatchUrls(comp_urls, competition, season, maximize_window)
    166 driver.execute_script("window.scrollTo(0, 400)")
--> 168 match_urls = getFixtureData(driver)
    170 match_urls = getSortedData(match_urls)

File ~/code/micheledeantoni/FSPM/data/main.py:251, in getFixtureData(driver)
    250 if len(table_rows) == 0:
--> 251     if('is-disabled' in driver.find_element(By.XPATH, '//*[@id="date-controller"]/a[1]').get_attribute('class').split()):
    252         break

File ~/.pyenv/versions/3.10.6/envs/FSPM/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:741, in WebDriver.find_element(self, by, value)
    739 value = f'[name="{value}"]'
--> 741 return self.execute(Command.FIND_ELEMENT, {"using": by, "value": value})['value']

File ~/.pyenv/versions/3.10.6/envs/FSPM/lib/python3.10/site-packages/selenium/webdriver/remote/webdriver.py:347, in WebDriver.execute(self, driver_command, params)
    345 response = self.command_executor.execute(driver_command, params)
    346 if response:
--> 347     self.error_handler.check_response(response)

NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id=\"date-controller\"]/a[1]"}
(Session info: chrome=124.0.6367.208)
For documentation on this error, please visit: https://www.selenium.dev/documentation/webdriver/troubleshooting/errors#no-such-element-exception
Stacktrace:
0   chromedriver                        0x00000001031caa78 chromedriver + 5216888
1   chromedriver                        0x00000001031c26b3 chromedriver + 5183155
2   chromedriver                        0x0000000102d34527 chromedriver + 406823
3   chromedriver                        0x0000000102d7fff2 chromedriver + 716786
4   chromedriver                        0x0000000102d80181 chromedriver + 717185
5   chromedriver                        0x0000000102dc41d4 chromedriver + 995796
6   chromedriver                        0x0000000102da272d chromedriver + 857901
7   chromedriver                        0x0000000102dc16bf chromedriver + 984767
8   chromedriver                        0x0000000102da24a3 chromedriver + 857251
9   chromedriver                        0x0000000102d72fe3 chromedriver + 663523
10  chromedriver                        0x0000000102d7392e chromedriver + 665902
11  chromedriver                        0x0000000103188990 chromedriver + 4946320
12  chromedriver                        0x000000010318ea44 chromedriver + 4971076
13  chromedriver                        0x000000010316948e chromedriver + 4818062
14  chromedriver                        0x000000010318f559 chromedriver + 4973913
15  chromedriver                        0x0000000103159714 chromedriver + 4753172
16  chromedriver                        0x00000001031b1c08 chromedriver + 5114888
17  chromedriver                        0x00000001031b1dc7 chromedriver + 5115335
18  chromedriver                        0x00000001031c22d3 chromedriver + 5182163
19  libsystem_pthread.dylib             0x00007ff813f7c18b _pthread_start + 99
20  libsystem_pthread.dylib             0x00007ff813f77ae3 thread_start + 15
Ali-Hasan-Khan commented 1 month ago

Hi Michele! Due to frequent change of the whoscored website layout this keeps happening and yes, I am working on it. :)

micheledeantoni commented 1 month ago

Thanks so much for your efforts in managing the updates to the Whoscored website! Keep up the great work!

Michele

On Tue, May 21, 2024 at 6:41 PM Ali Hasan Khan @.***> wrote:

Hi Michele! Due to frequent change of the whoscored website layout this keeps happening and yes, I am working on it. :)

— Reply to this email directly, view it on GitHub https://github.com/Ali-Hasan-Khan/Scrape-Whoscored-Event-Data/issues/5#issuecomment-2123027307, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQ3Q7VWCQDDYTYRGQ6G2F3ZDN2KPAVCNFSM6AAAAABIBM5Z2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMRTGAZDOMZQG4 . You are receiving this because you authored the thread.Message ID: @.*** com>

Ali-Hasan-Khan commented 1 month ago

I have fixed this bug you can check out if it works for you.

micheledeantoni commented 1 month ago

THank you very much for your work!

On Tue, May 28, 2024 at 8:18 PM Ali Hasan Khan @.***> wrote:

I have fixed this bug you can check out if it works for you.

— Reply to this email directly, view it on GitHub https://github.com/Ali-Hasan-Khan/Scrape-Whoscored-Event-Data/issues/5#issuecomment-2135855442, or unsubscribe https://github.com/notifications/unsubscribe-auth/AIQ3Q7R6RKLHEVQ4VGAKKOLZETC6PAVCNFSM6AAAAABIBM5Z2OVHI2DSMVQWIX3LMV43OSLTON2WKQ3PNVWWK3TUHMZDCMZVHA2TKNBUGI . You are receiving this because you authored the thread.Message ID: @.*** com>