How to Use Command Line Switches for IEDriver with Webdriver

1,621 views
Skip to first unread message

Siva

unread,
Jul 11, 2012, 6:45:31 AM7/11/12
to seleniu...@googlegroups.com
Hi all,

In the wiki page of IE Driver -  http://code.google.com/p/selenium/wiki/InternetExplorerDriver I found the command line switches to use specific port,host,log level etc. But I am not able to find any example or reference for using it along with Webdriver similar to Chrome Switches - Have any one used that and were able to launch IE with specified port?

For chrome, DesiredCapabilties object had a way to set the chrome.switches as ArrayList - How we can do it for IE?

I am using latest selenium 2.24.1 and IEDriver executable for version 2.24.2 - I tried with Options as HashMap and setting it in server object of Proxy.

HashMap options = new java.util.HashMap(); 
options.put("--port", "4413");
options.put("--log-level", "INFO"); 
server.setOptions(options);

But it is not working.Do we have to use IEDriverServer method for this standalone driver executable like - var ieServer = new InternetExplorerDriverServer(4413);

I also tried the same way as Chrome Executable - Setting InternetExplorerDriverService Builder

InternetExplorerDriverService.Builder ies = new InternetExplorerDriverService.Builder();
ies.usingDriverExecutable(ie_binary_path).usingPort(4413).build();
WebDriver driver = new InternetExplorerDriver(ies,capabilities); // But came to know that InternetExplorerDriver doesnt have those arguments to support both service and capabilities.

I tried switches like :

ArrayList<String> switches = new ArrayList<String>();    
switches.add("--port=4413");
switches.add("--log-level=INFO");
capabilities.setCapability("ie.switches",switches);

No Luck this time too - Can any one tell me what should be the exact code to launch IE in default port?

Regards,
Siva

Jim Evans

unread,
Jul 11, 2012, 6:59:51 AM7/11/12
to seleniu...@googlegroups.com
Looking at the current source code, there is a Builder class for the InternetExplorerDriverService[1]. Having said that, I have no idea if that code is available in the most recent binary release[2]. It should certainly be available in the next binary release, 2.25, which I would expect any day now.

--Jim

[1] http://selenium.googlecode.com/svn/trunk/java/client/src/org/openqa/selenium/ie/InternetExplorerDriverService.java
[2] Yes, I could comb through the Subversion history to figure it out, but I'm feeling lazy. :)

Krishnan Mahadevan

unread,
Jul 11, 2012, 7:00:20 AM7/11/12
to seleniu...@googlegroups.com
Please check if this helps : https://groups.google.com/d/topic/webdriver/t_HKzBpNkgw/discussion

Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To view this discussion on the web visit https://groups.google.com/d/msg/selenium-users/-/M7RikAKuJJYJ.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en-US.

Test SCF

unread,
Jul 11, 2012, 8:04:22 AM7/11/12
to seleniu...@googlegroups.com
Thanks Jim and Krishnan,

Jim, let me know the usage once its available in Selenium 2.25 - Waiting for it eagerly.


So far I have not gotten it working completely - It would be of great help if it is updated in wiki or documented in selenium pages.

Thanks,
Siva

Test SCF

unread,
Jul 23, 2012, 5:48:03 AM7/23/12
to seleniu...@googlegroups.com, browserm...@googlegroups.com
Hi Jim,

So I am using selenium 2.25.1 now and IEDriver is launching with default port and I am able to set InternetExplorerDriverService object along with DesiredCapabilities object as follows:

InternetExplorerDriverService.Builder ies = new InternetExplorerDriverService.Builder();
ies.usingDriverExecutable("D:\\IEDriverServer.exe").usingAnyFreePort().withLogFile(new File("somefile.log")).withLogLevel(InternetExplorerDriverLogLevel.DEBUG);
InternetExplorerDriverService service = ies.build();

So I am using HAR to capture the network traffic with ProxyServer and IE.

import org.browsermob.core.har.Har;
import org.browsermob.proxy.ProxyServer;
import org.openqa.selenium.Proxy;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.ie.InternetExplorerDriverLogLevel;
import org.openqa.selenium.ie.InternetExplorerDriverService;
import org.openqa.selenium.remote.CapabilityType;
import org.openqa.selenium.remote.DesiredCapabilities;

ProxyServer server = new ProxyServer(4413);
server.start();
Proxy proxy = server.seleniumProxy();

server.newHar("Test Web");
server.setCaptureHeaders(true);
server.setCaptureContent(true);

Har har = server.getHar();
har.writeTo(new File("D:\\test.har"));
System.out.println("BROWSER NAME: "+har.getLog().getBrowser().getName());

But I am getting Null Pointer exception for har object since it is not able to store any values stored in server.
Can you please tell me how to get the IEDriver work along with HAR? 
Is that browsermob proxy server start and IEDriver start are not getting binded on Capabilities object?

Cc'ing browser mob proxy group - Hope Patrick or someone from Browser mob proxy group also can shed some light here ! 

Regards,
Siva

Krishnan Mahadevan

unread,
Jul 23, 2012, 10:51:54 AM7/23/12
to browserm...@googlegroups.com, seleniu...@googlegroups.com
Siva,

You have created a proxy instance, but I dont see you binding that proxy object with the IEDriver.

So after you create a proxy instance : Proxy proxy = server.seleniumProxy();

shouldnt you be coupling it with the IEDriver ?

DesiredCapabilities dc = DesiredCapabilities.internetExplorer();
dc.setCapability(CapabilitiesType.PROXY, proxy);
InternetExplorerDriver ieDriver = new InternetExplorerDriver(dc);



Thanks & Regards
Krishnan Mahadevan

"All the desirable things in life are either illegal, expensive, fattening or in love with someone else!"



Test SCF

unread,
Jul 24, 2012, 8:46:12 AM7/24/12
to browserm...@googlegroups.com, seleniu...@googlegroups.com
Yes Krishnan, I am doing those steps like as below: 
Sorry for not pasting the whole code:

DesiredCapabilities dc = DesiredCapabilities.internetExplorer();
dc.setCapability(CapabilitiesType.PROXY, proxy);

InternetExplorerDriverService.Builder ies = new InternetExplorerDriverService.Builder();
ies.usingDriverExecutable(ie_binary_path).usingAnyFreePort().withLogFile(new File("IEDriver.log")).withLogLevel(InternetExplorerDriverLogLevel.DEBUG);
InternetExplorerDriverService service = ies.build();
WebDriver driver = new InternetExplorerDriver(service,capabilities); 

Still same issue persists!
Reply all
Reply to author
Forward
0 new messages