InternetExplorerDriver Constructor not Returning

317 views
Skip to first unread message

Nolan Green

unread,
Jul 15, 2011, 1:20:00 PM7/15/11
to Selenium Users
Hi, I am using selenium2 to create regression tests for my companies
web interface. I am coding in java 1.5.0_15 with the July 7 2011
release of selenium-java-2.0.0.zip and running the tests on a windows
7 virtual machine.

The goal is to be able to run the tests through ssh and cygwin,
meaning that any/all browser activity is happening off-screen.

So far, the tests run smoothly in Firefox, Chrome, and IE8 on my local
machine. But I am having an issue with InternetExplorerDriver when I
run the tests through ssh - the call 'new InternetExplorerDriver()'
seems to be entering an infinite loop. I have been looking at source
code (http://grepcode.com/file/repo1.maven.org/maven2/
org.seleniumhq.selenium/selenium-ie-driver/2.0a2/org/openqa/selenium/
ie/InternetExplorerDriver.java), but all I have been able to determine
is that the first line, initializeLib(), seems to be running
correctly, since I can observe the temporary directory and if I try to
delete the dll inside it, I get an error saying it is in use.

I suspect there is some issue with the 'lib' object, and specifically
the line 'int result = lib.wdNewDriverInstance(ptr);' Does this
function (or any other relevant functions) wait for the browser window
to be visible/displayed/active/etc? Can I find a better/more-up-to-
date copy of IEDriver.dll?

Let me know if I can provide any more information to help, Thanks!

Jim Evans

unread,
Jul 16, 2011, 8:35:17 AM7/16/11
to Selenium Users
If you're looking at sources from 2.0a2, you're looking at sources
that are extremely out of date. Latest sources can always be found at
http://selenium.googlecode.com/svn/trunk. In point of fact, the C++
code that launches IE does look for the existence of the IE window by
calling the EnumWindows API. We require the window handle to be able
to get a reference to the IWebBrowser2 COM interface that we use to
control IE. It seems to me that using the RemoteWebDriver might be a
better choice without the complexities of using ssh and (particularly)
cygwin.

Nolan Green

unread,
Aug 1, 2011, 3:11:02 PM8/1/11
to Selenium Users, james.h....@gmail.com
So I have been trying to use RemoteWebDriver instead of instantiating
InternetExplorerDriver directly. I want the tests to run on the
machine that holds the jar file containing the tests, so I am trying
to establish a RemoteWebDriver on localhost. I have made several
attempts, but the constructors keep throwing various Exceptions:

I get an UnsupportedCommandException when I run the following code

System.out.println("Instantiating Internet Explorer RemoteWebDriver");
DesiredCapabilities capabilities =
DesiredCapabilities.internetExplorer();
capabilities.setJavascriptEnabled(true);
try {
AppServer server = new AppServer();
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://
localhost/"), capabilities);
System.out.println("Instantiation complete");
}
...

with AppServer defined as:
import org.eclipse.jetty.server.Server;
import org.eclipse.jetty.server.nio.SelectChannelConnector;
import org.eclipse.jetty.webapp.WebAppContext;
import java.io.File;
public class AppServer {
private Server server = new Server();

public AppServer() throws Exception {
WebAppContext context = new WebAppContext();
context.setContextPath("");
context.setWar((new File(".")).getAbsolutePath());
server.setHandler(context.getHandler());

context.addServlet(DriverServlet.class, "/wd/*");

SelectChannelConnector connector = new SelectChannelConnector();
connector.setPort(3001);
server.addConnector(connector);

server.start();
}
}

The resulting error is:
org.openqa.selenium.UnsupportedCommandException: <!DOCTYPE HTML PUBLIC
"-//IETF//DTD HTML 2.0//EN">
<html><head>
<title>404 Not Found</title>
</head><body>
<h1>Not Found</h1>
<p>The requested URL /session was not found on this server.</p>
</body></html>

Do I need to create a handler for /session? What would it need to do?
If DriverServlet is supposed to be handling this kind of request, what
could be preventing this? The code that the AppServer is based off of
was using the mortbay version of jetty. Because I have the eclipse
libraries, some of the imports were different. The original code used
addHandler(), but in the eclipse version their seems to be only
setHandler(), could this be preventing the handler from being used
properly?

If I do not include the URL in the RemoteWebDriver constructor, I get
a MalformedURLException.

I have tried using InternetExplorerDriverServer, but I cannot actually
start the server:
System.out.println("Instantiating Internet Explorer RemoteWebDriver");
DesiredCapabilities capabilities =
DesiredCapabilities.internetExplorer();
capabilities.setJavascriptEnabled(true);
try {
InternetExplorerDriverServer IEDS = new
InternetExplorerDriverServer(80);
IEDS.start();
Thread.sleep(3000);
System.out.println("Getting URL");
System.out.println(IEDS.getUrl());
System.out.println("got URL");
RemoteWebDriver driver = new RemoteWebDriver(new URL("http://
localhost/"), capabilities);
System.out.println("Instantiation complete");
return driver;
}
...

The result I get is:
Instantiating Internet Explorer RemoteWebDriver
Getting URL
org.openqa.selenium.WebDriverException: Server has not yet been
started

Is port 80 correct/adequate? If I remove the getUrl() call, then I see
the same UnsupportedCommandException as before.

On Jul 16, 5:35 am, Jim Evans <james.h.evans...@gmail.com> wrote:
> If you're looking at sources from 2.0a2, you're looking at sources
> that are extremely out of date. Latest sources can always be found athttp://selenium.googlecode.com/svn/trunk. In point of fact, the C++

Simon Stewart

unread,
Aug 4, 2011, 6:52:32 AM8/4/11
to seleniu...@googlegroups.com
The URL you're using to create the remote webdriver instance with
isn't correct. It needs to contain the full path to the DriverServlet,
not just the host name.

Simon

> --
> You received this message because you are subscribed to the Google Groups "Selenium Users" group.
> 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.
>
>

Reply all
Reply to author
Forward
0 new messages