Home > Software engineering >  Selenium Webdriver Manager Doesn't Write in the Console Like Expected
Selenium Webdriver Manager Doesn't Write in the Console Like Expected

Time:01-16

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.

CodePudding user response:

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)

CodePudding user response:

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.

  • Related