question

APipaliya-0665 avatar image
0 Votes"
APipaliya-0665 asked YuZhou-MSFT edited

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

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


ms-edge
image.png (61.8 KiB)
image.png (55.9 KiB)
5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.

1 Answer

YuZhou-MSFT avatar image
0 Votes"
YuZhou-MSFT answered YuZhou-MSFT edited

Hi @APipaliya-0665

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

5 |1600 characters needed characters left characters exceeded

Up to 10 attachments (including images) can be used with a maximum of 3.0 MiB each and 30.0 MiB total.