Home > Back-end >  what is wrong with service in the following code?
what is wrong with service in the following code?

Time:10-13

I am trying to test my web page. I have the following code:

# Internet Explorer Browser version
from selenium import webdriver
from selenium.webdriver.ie.service import Service
from webdriver_manager.microsoft import IEDriverManager
driver = webdriver.Ie(service=Service(executable_path=IEDriverManager().install()))

driver.get('https://www.google.com')

The said code gives the following error:

[WDM] - Downloading: 100%|█| 1.03M/1.03M [00:00<00:00, 19.
Traceback (most recent call last):
  File "main.py", line 5, in <module>
    driver = webdriver.Ie(service=Service(executable_path=IEDriverManager().install()))
TypeError: __init__() got an unexpected keyword argument 'service'

What should I do, and what is the reason for the error message?

CodePudding user response:

Change the line to below as you are using IEDriverManager in this case you do not need to define the executable_path

driver = webdriver.Ie(service=Service(IEDriverManager().install()))

You can find the more detail here

  • Related