Internetexplorerdriver when no parameters are specified, the start of the listening port changes randomly. If you need to ensure that the port is fixed, you can achieve the goal by Internetexplorerdriverservice. Example code:
public class testinternetexplorerservice{
public static void Main (string[] args) {
System.setproperty ("Webdriver.ie.driver", "D:\Driver\IEDriverServer_Win32_2.37.0_latest\IEDriverServer.exe");
Internetexplorerdriverservice.builder Builder = new Internetexplorerdriverservice.builder ();
Internetexplorerdriverservice Internetexplorerservice = Builder.usingport (5678). Withhost ("127.0.0.1"). Build ();
Desiredcapabilities capab = Desiredcapabilities.internetexplorer ();
Capab.setcapability (Internetexplorerdriver.ie_ensure_clean_session, true);
capab.setcapability (Internetexplorerdriver.introduce_flakiness_by_ignoring_security_domains, True );
Webdriver Driver = new Internetexplorerdriver (Internetexplorerservice, capab);
Driver.get ("http://www.baidu.com");
}
}
How to make the port internetexplorerdriver every time it starts does not change randomly