MS Edge Chromium hangs while running through selenium webdriver

Rajesh Sivadasan 1 Reputation point
2021-02-20T18:20:36.63+00:00

Getting the below messages before the the launched browser hangs:

DevTools listening on ws://127.0.0.1:58504/devtools/browser/84667c0d-50ea-4b10-9a04-8eb6710b5144
[5580:2732:0220/233950.321:ERROR:browser_gpu_channel_host_factory.cc(168)] Failed to launch GPU process.
Traceback (most recent call last):
File "d:\python.vscode\applensDefa_New.py", line 10, in <module>
driver = Edge(executable_path=edge_driver_path)
File "D:\Python39\lib\site-packages\msedge\selenium_tools\webdriver.py", line 103, in init
RemoteWebDriver.init(
File "D:\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 157, in init
self.start_session(capabilities, browser_profile)
File "D:\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 252, in start_session
response = self.execute(Command.NEW_SESSION, parameters)
File "D:\Python39\lib\site-packages\selenium\webdriver\remote\webdriver.py", line 321, in execute
self.error_handler.check_response(response)
File "D:\Python39\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
from disconnected: received Inspector.detached event
(Session info: MicrosoftEdge=88.0.705.74)

Below is the python code that I am using to call edge:

from selenium import webdriver
from msedge.selenium_tools import Edge
strURL = r'www.google.com'
edge_driver_path = r"D:\Python\msedgedriver.exe"
driver = Edge(executable_path=edge_driver_path)
driver.implicitly_wait(300) # 5 minutes 
driver.get(strURL)

MS Edge version is : Version 88.0.705.74 (Official build) (64-bit)
The edge driver version is also the same.
Running on Windows 10 enterprise version

Python Version is 3.9.0 64 bit

Unable to make edge selenium webdriver based programs run. This keeps on breaking now and then.

Microsoft Edge
Microsoft Edge
A Microsoft cross-platform web browser that provides privacy, learning, and accessibility tools.
1,584 questions
0 comments No comments
{count} votes

1 answer

Sort by: Most helpful
  1. Deepak-MSFT 2,176 Reputation points Microsoft Vendor
    2021-02-22T06:47:16.68+00:00

    @Rajesh Sivadasan ,
    I suggest you try to make a test with the sample code below. I have tested it with the MS Edge version 88.0.705.74 and it works fine.

    Python Selenium code:

    from msedge.selenium_tools import Edge, EdgeOptions  
      
    options = EdgeOptions()  
    options.use_chromium = True  
    options.binary_location = r"C:\Program Files (x86)\Microsoft\Edge\Application\msedge.exe"  
    driver = Edge(executable_path = r"Edge_driver_path_here....", options = options) # Modify the path here...  
      
    driver.get("http://Your_website_here...")  # Modify the URL here...  
    #driver.quit  
    

    Further, you can try to modify the code example as per your own requirements.

    ----------

    If the response is helpful, please click "Accept Answer" and upvote it.
    Note: Please follow the steps in our documentation to enable e-mail notifications if you want to receive the related email notification for this thread.

    0 comments No comments