简体   繁体   中英

The method attachToEdgeChrome() is undefined for the type InternetExplorerOptions using selenium-server-4.0.0-alpha-2

I want test the IE mode for Edge browser with Selenium. I found the solution on the MS site here: https://learn.microsoft.com/en-us/microsoft-edge/webdriver-chromium/ie-mode?tabs=java

I am using the following code as given in the above link:

import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerOptions;

InternetExplorerOptions ieOptions = new InternetExplorerOptions();
ieOptions.attachToEdgeChrome();
ieOptions.withEdgeExecutablePath("C:\\Program Files (x86)\\Microsoft\\Edge\\Application\\msedge.exe");
WebDriver driver = new InternetExplorerDriver(ieOptions);

I can get the error that the methods "attachToEdgeChrome()" and "withEdgeExecutablePath()" are not defined in the Inte.netExplorerOptions. Is there anything I am missing here?

Note : My selenium jar is selenium-server-4.0.0-alpha-2.jar

As per the ChangeLogs 0f Selenium v4.0.0.0-alpha-2 :

  • Add Chromium-based Edge support. This involves adding a new Chromium driver to the tree too.

So ideally, the code block from the documentation Use Inte.net Explorer Driver to automate IE mode in Microsoft Edge should have worked seamlessly.

However, as per best practices instead of using the alpha and beta releases, you should always prefer the GA releases to execute your tests and you can pickup anyone from the following options:

  • Selenium v4.1.3
  • Selenium v4.1.2
  • Selenium v4.1.1
  • Selenium v4.1.0
  • Selenium v4.0.0

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM