简体   繁体   中英

How can I start installed browser without adding IE driver or Chrome driver in selenium web driver?

I have installed IE and chrome browser in my computer. I want to run my selenium script from original browser with all add-ons and default setting.

I am able to find *.exe of browser with some capabilities.But can not able to write and open link (driver.get()) in browser. Please refer following code.

DesiredCapabilities cap = new DesiredCapabilities();
cap.setCapability(InternetExplorerDriver.INTRODUCE_FLAKINESS_BY_IGNORING_SECURITY_DOMAINS, true);
cap.setCapability(InternetExplorerDriver.INITIAL_BROWSER_URL, DriverTestNG.url);
DesiredCapabilities.internetExplorer().setCapability("ignoreProtectedModeSettings", true);
System.setProperty("webdriver.ie.driver", "src/main/resources/Framework/Drivers/Windows/IEDriverServer_Win32_2.40.0/IEDriverServer.exe");
cap.setCapability("IE.binary", "C:\\Program Files\\Internet Explorer\\iexplore.exe");
cap.setCapability(CapabilityType.ACCEPT_SSL_CERTS, true);
cap.setJavascriptEnabled(true);
cap.setCapability("requireWindowFocus", true);
cap.setCapability("enablePersistentHover", false);
cap.setCapability("elementScrollBehavior", 1);
cap.setCapability("cssSelectorsEnabled", true);
cap.setCapability("nativeEvents", true);
driver = new InternetExplorerDriver(cap);

May be I have missed something.I am not sure about this that selenium web driver supports this functionality or not.

Please guide me for it.

Thanks in advance.

Regarding to your title, you can not run Internet Explorer or Chrome without using a webDriver because you need the webDriver as an API to access the functionality of IE or chrome.

But you can still use extensions and your default settings. The reason why you don't see any extensions running chromeDriver is that it always creates a new temporary profile for each test-session. If you want to run your own custom profile with extensions and settings you have to tell chromeDriver which user profile it should use by defining the user-data-dir .

You can find the capabilities here: https://sites.google.com/a/chromium.org/chromedriver/capabilities

example:

ChromeOptions options = new ChromeOptions();
options.addArguments("user-data-dir=C:/Users/user_name/AppData/Local/Google/Chrome/User Data");

You can also specifiy extensions by using: https://sites.google.com/a/chromium.org/chromedriver/extensions

I don't use IEdriver so I can't tell you how it works with the IE but as far as i know the internet explorer does not have profiles and the extensions are managed somewhere in the registry. So I would assume that extensions installed before running the tests are available also trough IEWebDriver .

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