How to set Edge Capabilities for Edge browser in python selenium 3.141.0

A Pipaliya 21 Reputation points
2022-05-06T13:22:33.567+00:00

Hello,

I like to use set_capability function of Edge option to set below browser capabilities. Anyone knows how can I set below capabilities in Edge browser.

Disable-infobars: to prevent edge browser from displaying notifications
Inprivate: to open edge browser in private mode
start-maximized: to open edge browser in maximized mode
Headless: to open the edge browser in headless mode.
PageLoadStrategy: to set page load strategy to normal/eager/none.
Binary: to set binary path

I'm using edge browser (101.0.1210.39) and edge option from python selenium 3.141.0. So it don't have add_argument / add_experimental_option like functions.

I know in python selenium 4, we can do this:
199589-image.png

So, similar to that I did this in selenium 3.141.0 but it didn't work
199600-image.png

Let me know how to set options and arguments using set_capability function in python selenium 3 for Edge browser

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

Accepted answer
  1. Yu Zhou-MSFT 12,941 Reputation points Microsoft Vendor
    2022-05-09T08:08:56.443+00:00

    Hi @A Pipaliya

    You need to install Selenium Tools for Microsoft Edge if you want to use Selenium 3.141.0. Then you can still use add_argument to set the capabilities.

    You can install Selenium Tools for Microsoft Edge using the command below:

    pip install msedge-selenium-tools selenium==3.141  
    

    Sample code:

    from msedge.selenium_tools import Edge,EdgeOptions  
      
    edge_options = EdgeOptions()  
    edge_options.use_chromium = True  
    edge_options.add_argument("start-maximized")  
    edge_options.add_argument("inprivate")   
      
    driver = Edge(executable_path = "your_own_path_to_the_webdriver\\msedgedriver.exe", options=edge_options)  
    driver.get('https://www.google.com')  
    

    In addition, I suggest that you use the latest version of Selenium which don't need Selenium Tools for Microsoft Edge. You can also see that Selenium Tools for Microsoft Edge is deprecated and the Selenium project no longer maintains Selenium 3.


    If the answer is the right solution, please click "Accept Answer" and kindly upvote it. If you have extra questions about this answer, please click "Comment".
    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.

    Regards,
    Yu Zhou

    0 comments No comments

0 additional answers

Sort by: Most helpful