oseymour / ScraperFC

Python package for scraping soccer data from a variety of sources
GNU General Public License v3.0
222 stars 49 forks source link

FBRef Complete Scouting Report Not Working #14

Closed evanmahony closed 1 year ago

evanmahony commented 1 year ago

Hi there,

Great repository, really enjoying using it.

I noticed when using FBRef().complete_report_from_player_link(), it seems to be giving me a NoSuchElementException. Seems to be getting caught on finding the link for the scouting report. I've tried copying the XPATH from the website and finding the element by the link text but neither seems to work. I've attached the error message below. Thought you'd like to know!

Thanks, Ev

Traceback (most recent call last): File "D:\projects\fpl\scouting_report.py", line 4, in <module> scraper.complete_report_from_player_link("https://fbref.com/en/players/972aeb2a/William-Saliba") File "C:\Users\Evan\AppData\Local\Programs\Python\Python39\lib\site-packages\ScraperFC\FBRef.py", line 758, in complete_report_from_player_link complete_report_button = self.driver.find_element( File "C:\Users\Evan\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 855, in find_element return self.execute(Command.FIND_ELEMENT, { File "C:\Users\Evan\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 428, in execute self.error_handler.check_response(response) File "C:\Users\Evan\AppData\Local\Programs\Python\Python39\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 243, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"/html/body/div[2]/div[6]/div[2]/div[1]/div/div/div[1]/div/ul/li[2]/a"} (Session info: headless chrome=105.0.5195.127) Stacktrace: Backtrace: Ordinal0 [0x011EDF13+2219795] Ordinal0 [0x01182841+1779777] Ordinal0 [0x0109423D+803389] Ordinal0 [0x010C3025+995365] Ordinal0 [0x010C31EB+995819] Ordinal0 [0x010F0F52+1183570] Ordinal0 [0x010DE844+1108036] Ordinal0 [0x010EF192+1175954] Ordinal0 [0x010DE616+1107478] Ordinal0 [0x010B7F89+950153] Ordinal0 [0x010B8F56+954198] GetHandleVerifier [0x014E2CB2+3040210] GetHandleVerifier [0x014D2BB4+2974420] GetHandleVerifier [0x01286A0A+565546] GetHandleVerifier [0x01285680+560544] Ordinal0 [0x01189A5C+1808988] Ordinal0 [0x0118E3A8+1827752] Ordinal0 [0x0118E495+1827989] Ordinal0 [0x011980A4+1867940] BaseThreadInitThunk [0x7515FA29+25] RtlGetAppContainerNamedObjectPath [0x770F7B5E+286] RtlGetAppContainerNamedObjectPath [0x770F7B2E+238]

error.txt

oseymour commented 1 year ago

Hey Evan! Thanks for using the package and thanks for flagging this. It's on the to-do list.

oseymour commented 1 year ago

Hey @evanmahony, just posting an update. I've got a fix for this, just doing some testing. I'm hoping to have it pushed this weekend.

oseymour commented 1 year ago

@evanmahony I did some testing tonight and I'm pretty sure this is fixed. New code is here and GitHub and uploaded to PyPI in v2.2.2. If it isn't working for you, go ahead and re-open and post the traceback.