Python Forum
How to use Selenium on EdgeHTML, when having WebDrivers in other location?
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
How to use Selenium on EdgeHTML, when having WebDrivers in other location?
#1
I want to launch Python script on EdgeHTML (Edge v.18 Legacy), using Selenium. But I face a problem to do a connection. I'm trying to launch it on job computer, but I can't install MicrosoftWebDriver.exe in Windows/System32 folder, because of access rights. I want to make a path to MicrosoftWebDriver.exe, which I store in other location in computer, but it does not work. Instead, it turns off the Edge instance completely.

import ctypes
from msedge.selenium_tools import Edge, EdgeOptions
# Launch Microsoft Edge (EdgeHTML)
driver = Edge(executable_path = r'C:\\Users\\zzz\\Desktop\\Projects\\MicrosoftWebDriver.exe')
ctypes.windll.user32.MessageBoxW(0, driver.title, "Current page title", 0)
When I try to run it, I get these errors in CMD:
Traceback (most recent call last):
  File "EdgeHTML.py", line 9, in <module>
    driver = Edge(executable_path = r'C:\\Users\\zzz\\Desktop\\Projects\\MicrosoftWebDriver.exe')
  File "C:\Users\zzz\AppData\Roaming\Python\Python37\site-packages\msedge\selenium_tools\webdriver.py", line 108, in __init__
    desired_capabilities=desired_capabilities)
  File "C:\Users\zzz\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in __init__
    self.start_session(capabilities, browser_profile)
  File "C:\Users\zzz\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
    response = self.execute(Command.NEW_SESSION, parameters)
  File "C:\Users\zzz\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
    self.error_handler.check_response(response)
  File "C:\Users\zzz\AppData\Roaming\Python\Python37\site-packages\selenium\webdriver\remote\errorhandler.py", line 208, in check_response
raise exception_class(value)
selenium.common.exceptions.WebDriverException: Message: Unknown error
Reply
#2
If the EXE file does not run, open the Registry Editor. If you receive an error message when opening and running the EXE file or the file does not run, there may be a problem with your Windows registry settings. Although editing the registry section may seem a bit risky, it does not take more than a few minutes.

To open the Registry Editor, press Windows key + R and type regedit.

Go to .HKEY_CLASSES_ROOT \ .exe. Use the tree menu on the left side of the window to open this directory.

Right-click on "(Default)" input and select "Modify". Doing so will open a new window.

In the "Value data" box, type .exefile. Click OK to save the changes.

Go to the .HKEY_CLASSES_ROOT \ exefile directory. Use the tree menu on the left to access this directory.

Right-click on "(Default)" input and select "Modify". Doing so will open a new window.

Enter the value "% 1"% * in the "Value data" box. Click OK to save the changes.

Go to the .KEY_CLASSES_ROOT \ exefile \ shell \ open directory. Use the tree menu on the left to access this directory.

Right-click on "(Default)" and select "Modify". Doing so will open a new window.

Enter the value "% 1"% * in the "Value data" box. Click OK to save the changes.

Restart the computer. After editing all three of the above values, close the registry editor and restart your computer. You should now be able to run EXE files. It is strongly recommended that you investigate the cause of the problem in the first place. Your computer may be infected with a virus or malware, in which case it could cause the same problem again in the future.
Reply
#3
I don't think I will have permissions to do those actions in work computer. As well I cannot expect all users will be able to do that by themselves. Is there any other way to connect that webdriver just by using Python script, without manually going and changing Windows settings?
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  With Selenium create a google Search list in Incognito mode withe specific location, tsurubaso 3 3,185 Jun-15-2020, 12:34 PM
Last Post: tsurubaso
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,584 Nov-03-2017, 08:41 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020