aapatre / Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE

Do you want to LEARN NEW STUFF for FREE? Don't worry, with the power of web-scraping and automation, this script will find the necessary Udemy coupons & enroll you for PAID UDEMY COURSES, ABSOLUTELY FREE!
GNU General Public License v3.0
3.17k stars 553 forks source link

[BUG] Exception in redeem courses: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"} #409

Closed ducdat-ptit closed 1 year ago

ducdat-ptit commented 1 year ago

When I apply the command "udemy_enroller", the command returns the following error. Please tell me how to fix the below issue?

** python udemy_enroller.py --browser chrome Loading existing settings

[WDM] - ====== WebDriver manager ====== [WDM] - Current google-chrome version is 108.0.5359 [WDM] - Get LATEST chromedriver version for 108.0.5359 google-chrome [WDM] - Driver [C:\Users\admin.wdm\drivers\chromedriver\win32\108.0.5359.71\chromedriver.exe] found in cache

DevTools listening on ws://127.0.0.1:64921/devtools/browser/ba65e4a7-f83f-4dde-99f5-d4de6aba1d16 Exception in redeem courses: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"} (Session info: chrome=108.0.5359.96)

Closing browser **

cullzie commented 1 year ago

Hey @ducdat-ptit, Could you please provide the full command you are using to run the tool please? The browser based path should not be triggered unless you specify the --browser flag unless you are running an older version. Using the REST based API is much more stable.

ahmedfarrag17 commented 1 year ago

@cullzie I am having the same issue! I launch the CMD on the folder where I downloaded the source files of your udemy enroller and execute udemy_enroller --browser=chrome

But the chrome window immediately shuts down! I receive this error message on CMD:

DevTools listening on ws://127.0.0.1:50748/devtools/browser/4bc533b4-f4d5-4a2b-bc14-a7924726f3eb [6380:8568:1221/181103.676:ERROR:device_event_log_impl.cc(215)] [18:11:03.675] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: Un dispositivo collegato al sistema non Þ in funzione. (0x1F) [6380:8568:1221/181103.677:ERROR:device_event_log_impl.cc(215)] [18:11:03.677] USB: usb_device_handle_win.cc:1045 Failed to read descriptor from node connection: Un dispositivo collegato al sistema non Þ in funzione. (0x1F) Exception in redeem courses: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"} (Session info: chrome=108.0.5359.125)

Closing browser

Note: my Windows 11 is in Italian so "Un dispositivo collegato al sistema non in funzione" means a connected device to the system doesn't work (don't know what device it is talking about honestly :D ).

Any solution? Thank you!

ducdat-ptit commented 1 year ago

Hey @ducdat-ptit, Could you please provide the full command you are using to run the tool please? The browser based path should not be triggered unless you specify the --browser flag unless you are running an older version. Using the REST based API is much more stable.

@cullzie app.log

This is the full command. D:\Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE-master>udemy_enroller --browser=chrome Loading existing settings

[WDM] - ====== WebDriver manager ====== [WDM] - Current google-chrome version is 108.0.5359 [WDM] - Get LATEST chromedriver version for 108.0.5359 google-chrome [WDM] - About to download new driver from https://chromedriver.storage.googleapis.com/108.0.5359.71/chromedriver_win32.zip [WDM] - Driver has been saved in cache [C:\Users\admin.wdm\drivers\chromedriver\win32\108.0.5359.71]

DevTools listening on ws://127.0.0.1:50852/devtools/browser/074d87a3-eb2f-455f-8b5e-54cb8f30e0ce Exception in redeem courses: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"} (Session info: chrome=108.0.5359.125)

Closing browser

D:\Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE-master>udemy_enroller --browser=chromium Loading existing settings

[WDM] - ====== WebDriver manager ====== [WDM] - Current chromium version is 91.0.4472 [WDM] - Get LATEST chromedriver version for 91.0.4472 chromium [WDM] - About to download new driver from https://chromedriver.storage.googleapis.com/91.0.4472.101/chromedriver_win32.zip [WDM] - Driver has been saved in cache [C:\Users\admin.wdm\drivers\chromedriver\win32\91.0.4472.101]

DevTools listening on ws://127.0.0.1:50893/devtools/browser/07c02dd1-6e1a-46ac-a227-13f127bc057e Traceback (most recent call last): File "c:\users\admin\appdata\local\programs\python\python38-32\lib\runpy.py", line 194, in _run_module_as_main return _run_code(code, main_globals, None, File "c:\users\admin\appdata\local\programs\python\python38-32\lib\runpy.py", line 87, in _run_code exec(code, run_globals) File "C:\Users\admin\AppData\Local\Programs\Python\Python38-32\Scripts\udemy_enroller.exe__main.py", line 7, in File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\udemy_enroller\cli.py", line 191, in main run( File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\udemy_enroller\cli.py", line 83, in run dm = DriverManager(browser=browser, is_ci_build=settings.is_ci_build) File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\udemy_enroller\driver_manager.py", line 29, in init self._init_driver() File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\udemy_enroller\driver_manager.py", line 46, in _init_driver self.driver = webdriver.Chrome( File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\selenium\webdriver\chrome\webdriver.py", line 76, in init RemoteWebDriver.init( File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init__ self.start_session(capabilities, browser_profile) File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session response = self.execute(Command.NEW_SESSION, parameters) File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute self.error_handler.check_response(response) File "c:\users\admin\appdata\local\programs\python\python38-32\lib\site-packages\selenium\webdriver\remote\errorhandler.py", line 242, in check_response raise exception_class(message, screen, stacktrace) selenium.common.exceptions.SessionNotCreatedException: Message: session not created: This version of ChromeDriver only supports Chrome version 91 Current browser version is 108.0.5359.125 with binary path C:\Program Files (x86)\Google\Chrome\Application\chrome.exe

D:\Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE-master>udemy_enroller --browser=google-chrome Loading existing settings

[WDM] - ====== WebDriver manager ====== [WDM] - Current google-chrome version is 108.0.5359 [WDM] - Get LATEST chromedriver version for 108.0.5359 google-chrome [WDM] - Driver [C:\Users\admin.wdm\drivers\chromedriver\win32\108.0.5359.71\chromedriver.exe] found in cache

DevTools listening on ws://127.0.0.1:55493/devtools/browser/b2423b9f-fe35-43e0-9bd3-3f8c26238c4a Exception in redeem courses: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"} (Session info: chrome=108.0.5359.125)

Closing browser

cullzie commented 1 year ago

@ducdat-ptit Thanks for the details. I would recommend using the REST based enrollment from now on. Using udemy_enroller without the browser option will do this if you are on version 4.1.2 of this library. The UI based enrollment is very flaky and can change based on many things e.g. speed of internet connection etc.

@ahmedfarrag17 I think this is the same issue you are experiencing: https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/issues/410

ahmedfarrag17 commented 1 year ago

@cullzie when I execute udemy_enroller without specifing the browser, i still receive an error (but it is different from the previous one).

Loading existing settings No cookie available Exception in redeem courses: Unable to get csrf_token

Any way to fix this?

Thanks!

frankShih commented 1 year ago

@cullzie when I execute udemy_enroller without specifing the browser, i still receive an error (but it is different from the previous one).

Loading existing settings No cookie available Exception in redeem courses: Unable to get csrf_token

Any way to fix this?

Thanks!

Same issue. Any suggestions?

cullzie commented 1 year ago

@ahmedfarrag17 @frankShih I still am not having this issue so its very hard to debug it :cry: Do you run the scripts very often? Can you still login? (without using the scripts)

Perhaps there is some rate-limiting or something going on here but that is just speculation

cullzie commented 1 year ago

Ok I got the error and there was already a PR to fix this issue. (Thanks @Asunnya) I will try to release a version in the next few days.

ahmedfarrag17 commented 1 year ago

Ok I got the error and there was already a PR to fix this issue. (Thanks @Asunnya) I will try to release a version in the next few days.

Thanks 🙏🏽

TriRizki commented 1 year ago

@cullzie hi, I just want to make sure. Have you fixed the issue ? thank you

baseplate-admin commented 1 year ago

@cullzie hi, I just want to make sure. Have you fixed the issue ? thank you

Hi there,

https://github.com/aapatre/Automatic-Udemy-Course-Enroller-GET-PAID-UDEMY-COURSES-for-FREE/pull/411

Was the issue that fixed this

Please install the latest master :)

let me know if you see any more issues

cullzie commented 1 year ago

@TriRizki @baseplate-admin Latest version of the library (4.1.3) has been merged to master and published to pypi

ahmedfarrag17 commented 1 year ago

@baseplate-admin I installed the latest version 4.1.3 and I still receive the same error! the browser window opens and in few seconds it closes automatically. the error:

`Loading existing settings

[WDM] - ====== WebDriver manager ====== [WDM] - Current google-chrome version is 111.0.5563 [WDM] - Get LATEST chromedriver version for 111.0.5563 google-chrome [WDM] - Driver [C:\Users\ahmed.wdm\drivers\chromedriver\win32\111.0.5563.64\chromedriver.exe] found in cache

DevTools listening on ws://127.0.0.1:51612/devtools/browser/16aca066-69e7-4b08-b275-4e7c4a5c7132 Exception in redeem courses: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[name="email"]"} (Session info: chrome=111.0.5563.64)

Closing browser`

rss-de commented 1 year ago

@cullzie hi, I just want to make sure. Have you fixed the issue ? thank you

Hi there,

411

Was the issue that fixed this

Please install the latest master :)

let me know if you see any more issues

Hi! The issue still persists with the newest version for me. Getting the same error:

No cookie available
Exception in redeem courses: Unable to get csrf_token

Thanks!

cullzie commented 1 year ago

@ahmedfarrag17 Can you please try running with the CLI option? It is much more stable than browser version udemy_enroller

@nordflow I am not seeing this issue unfortunately. Are you running using a VPN?

ahmedfarrag17 commented 1 year ago

@cullzie I am receiving the same error as @nordflow ! I open CMD on the folder where I downloaded and installed the Udemy Enroller, and executed "udemy_enroller". the error it gives me is

No cookie available Exception in redeem courses: Unable to get csrf_token

If I run udemy_enroller --browser=chrome instead, I receive the error I just typed above.

cullzie commented 1 year ago

@ahmedfarrag17 Can you run udemy_enroller --debug and let me know the system and version details please (If there are no version details you are not running v4.1.3 yet)

rss-de commented 1 year ago

@cullzie Where should the version show up? Looks the same for me:

2023-03-08 20:48:26,867 - udemy_enroller - INFO - cli : Enabled debug logging
2023-03-08 20:48:26,867 - udemy_enroller - INFO - settings : Loading existing settings
2023-03-08 20:48:26,880 - udemy_enroller - INFO - udemy_rest : No cookie available
2023-03-08 20:48:27,320 - udemy_enroller - ERROR - runner : Exception in redeem courses: Unable to get csrf_token

However, I'm running from the newest source code.

cullzie commented 1 year ago

@nordflow It should be in the first few lines printed out to the console, before the lines you are seeing. Can you check with pip what version of the script you have installed in that case please? Seems it is not 4.1.3 If you are running directly from the repo could you please sync your branch with master

rss-de commented 1 year ago

Hi @cullzie, you were right! I thought I was running the script from my folder. But it was running the installed pip version which wasn't up to date. It is all working fine now. Thanks again!

ahmedfarrag17 commented 1 year ago

@cullzie I restarted the PC and re-installed the requirements and now it works!! (probably because the first time it asked me to update pip! so I think it is necessary to restart the PC after updating it, reinstall the requirements again, run and it works). but I noticed only udemy_enroller works! specifying the browser (udemy_enroller --browser=chrome) gives error!

ahmedfarrag17 commented 1 year ago

@cullzie thank you so much for your help! now it works!!

cullzie commented 1 year ago

@nordflow @ahmedfarrag17 Glad you are both back in business.

Yes the browser version has been neglected for a while now since the CLI version is a lot more stable and less prone to changes. The browser version will likely be removed in future as all functionality is already available in the CLI version