Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

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

Closed
ducdat-ptit opened this issue Dec 12, 2022 · 23 comments
Labels
bug Something isn't working

Comments

@ducdat-ptit
Copy link

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
**

@ducdat-ptit ducdat-ptit added the bug Something isn't working label Dec 12, 2022
@cullzie
Copy link
Collaborator

cullzie commented Dec 20, 2022

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
Copy link

@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
Copy link
Author

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
Copy link
Collaborator

cullzie commented Dec 23, 2022

@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:
#410

@ahmedfarrag17
Copy link

@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
Copy link

@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
Copy link
Collaborator

cullzie commented Jan 6, 2023

@ahmedfarrag17 @frankShih I still am not having this issue so its very hard to debug it 😢
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
Copy link
Collaborator

cullzie commented Jan 8, 2023

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
Copy link

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
Copy link

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

@baseplate-admin
Copy link
Contributor

@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

@cullzie
Copy link
Collaborator

cullzie commented Mar 7, 2023

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

@ahmedfarrag17
Copy link

@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
Copy link

rss-de commented Mar 8, 2023

@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
Copy link
Collaborator

cullzie commented Mar 8, 2023

@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
Copy link

@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
Copy link
Collaborator

cullzie commented Mar 8, 2023

@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
Copy link

rss-de commented Mar 8, 2023

@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
Copy link
Collaborator

cullzie commented Mar 8, 2023

@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
Copy link

rss-de commented Mar 8, 2023

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
Copy link

@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
Copy link

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

@cullzie
Copy link
Collaborator

cullzie commented Mar 8, 2023

@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

@cullzie cullzie closed this as completed Mar 11, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
bug Something isn't working
Projects
None yet
Development

No branches or pull requests

7 participants