0

https://www.youtube.com/watch?v=Z3M2GBu8t_k&list=PLL34mf651faPOf5PE5YjYgTRITzVzzvMz&index=11 I've been following this youtube tutorial as I set up Selenium. Once he downloads the webdriver manager and runs his code, he gets a lot of [WDM}... output, but I don't get that.

DeprecationWarning: executable_path has been deprecated selenium python This link also shows the output that I'm not getting, so I think I'm doing something wrong. Here's my code:

from selenium import webdriver
from selenium.webdriver.chrome.service import Service

from webdriver_manager.chrome import ChromeDriverManager
driver = webdriver.Chrome(service=Service(ChromeDriverManager().install()))
driver.get("https://www.rcvacademy.com")
driver.maximize_window()
print(driver.title)
driver.close()

And this is my output:

"C:\Program Files\Python311\python.exe" C:\python-selenium\PythonSeleniumProject1\LearningSelenium\AutomationTestv2.py 
Home El - RCV Academy

Process finished with exit code 0

What am I doing wrong?

I'm not exactly sure what to try

  • Is it only that you don't get the deprecation warning or that the Chrome window doesn't even open? – M B Jan 16 '23 at 03:54
  • It seems that you are getting the title of said webpage, so it seems that something is right. What version of Selenium are you using ? – ScottC Jan 16 '23 at 05:14
  • You are asking for why [WDM] - logs are not displayed in the console right? – AbiSaran Jan 16 '23 at 05:18

3 Answers3

0

As per webdriver-manager website - with the latest versions, you need to setup the logging process. You can enable logging by running this script:

Setup Logging

import logging
from webdriver_manager.core.logger import set_logger

logger = logging.getLogger("custom_logger")
logger.setLevel(logging.DEBUG)
logger.addHandler(logging.StreamHandler())
logger.addHandler(logging.FileHandler("custom.log"))

set_logger(logger)

You should then be able to carry on as per normal
(provided you are using Chrome, and Selenium v4):

Here is the suggested code (which is slightly different to yours):

Code:

# selenium 4
from selenium import webdriver
from selenium.webdriver.chrome.service import Service as ChromeService
from webdriver_manager.chrome import ChromeDriverManager

driver = webdriver.Chrome(service=ChromeService(ChromeDriverManager().install()))

driver.get("https://www.rcvacademy.com")
driver.maximize_window()
print(driver.title)
driver.close()

Output:

====== WebDriver manager ======
Get LATEST chromedriver version for google-chrome 109.0.5414
Driver [C:\Users\scottc\.wdm\drivers\chromedriver\win32\109.0.5414\chromedriver.exe] found in cache
Home El - RCV Academy

Note:

The amount of information logged will depend on whether or not you currently have the latest driver installed. If you already have the latest driver installed, then you should expect to see minimal lines (as per the output above). However, if you are missing the current driver on your system, you can expect to see a more verbose output.

Logging is optional, and not necessary for successful website analysis.

ScottC
  • 3,941
  • 1
  • 6
  • 20
0

Those are the information used to appear in the console if you use the older version of webdriver-manager.

I installed webdriver_manager v3.3.0 as you mentioned in the youtube video, I got the below log in the console:

enter image description here

In the latest versions, you won't get that.

You can check by uninstalling the newer version and installing the older version in Pycharm. Go to Python Packages > search and select webdriver-manager > in the right side pane > select delete package. Then you can install the older version from the dropdown and verify.

AbiSaran
  • 2,538
  • 3
  • 9
  • 15
0

You just trying to print the title of the page only then what you more expected from the webdriver.

if you want to look over the whole page content, then you can try

print(driver.page_source)

  • Your answer could be improved with additional supporting information. Please [edit] to add further details, such as citations or documentation, so that others can confirm that your answer is correct. You can find more information on how to write good answers [in the help center](/help/how-to-answer). – jv-k Jan 17 '23 at 04:49