[2.0 a1] RuntimeException: Cannot locate the embedded selenium instance

83 views
Skip to first unread message

Marcel Overdijk

unread,
Dec 16, 2009, 2:57:58 PM12/16/09
to webdriver
I'm running this code using WebDriverBackedSelenium:

// open author index page and verify it's the list page and
contains authors created in BootStrap.groovy
open("/author")
waitForPageToLoad("30000")
assertTrue("Author List expected", isTextPresent("Author
List"))
assertTrue("Greame Rocher expected", isTextPresent("Graeme
Rocher"))
assertTrue("Glen Smith expected", isTextPresent("Glen Smith"))
assertFalse("Dierk Koenig not expected", isTextPresent("Dierk
Koenig"))

// click create page and create new author
click("link=New Author")
waitForPageToLoad("30000")
assertTrue("Create Author expected", isTextPresent("Create
Author"))
type("name", "Dierk")

But at the last line I get this error:

java.lang.RuntimeException: Cannot locate the embedded selenium
instance
at
org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary.readScript
(JavascriptLibrary.java:74)
at
org.openqa.selenium.internal.seleniumemulation.JavascriptLibrary.callEmbeddedSelenium
(JavascriptLibrary.java:40)
at
org.openqa.selenium.internal.seleniumemulation.Type.handleSeleneseCommand
(Type.java:45)
at
org.openqa.selenium.internal.seleniumemulation.Type.handleSeleneseCommand
(Type.java:25)
at
org.openqa.selenium.internal.seleniumemulation.SeleneseCommand.apply
(SeleneseCommand.java:33)
at org.openqa.selenium.WebDriverCommandProcessor.execute
(WebDriverCommandProcessor.java:270)
at org.openqa.selenium.WebDriverCommandProcessor.doCommand
(WebDriverCommandProcessor.java:188)
at com.thoughtworks.selenium.DefaultSelenium.type
(DefaultSelenium.java:301)
at com.thoughtworks.selenium.Selenium$type$0.call(Unknown Source)
at org.grails.plugins.webdriver.selenium.WebTestCase.type
(WebTestCase.groovy)
at com.thoughtworks.selenium.Selenium$type.callCurrent(Unknown
Source)
at com.mycompany.AuthorWebTests.testSomething(AuthorWebTests.groovy:
19)
at junit.framework.Test$run.call(Unknown Source)
at _GrailsTest_groovy$_run_closure4.doCall(_GrailsTest_groovy:262)
at _GrailsTest_groovy$_run_closure4.call(_GrailsTest_groovy)
at _GrailsTest_groovy$_run_closure2.doCall(_GrailsTest_groovy:221)
at _GrailsTest_groovy$_run_closure1_closure21.doCall
(_GrailsTest_groovy:181)
at _GrailsTest_groovy$_run_closure1.doCall(_GrailsTest_groovy:168)
at TestApp$_run_closure1.doCall(TestApp.groovy:102)
at gant.Gant$_dispatch_closure4.doCall(Gant.groovy:324)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy:334)
at gant.Gant$_dispatch_closure6.doCall(Gant.groovy)
at gant.Gant.withBuildListeners(Gant.groovy:344)
at gant.Gant.this$2$withBuildListeners(Gant.groovy)
at gant.Gant$this$2$withBuildListeners.callCurrent(Unknown Source)
at gant.Gant.dispatch(Gant.groovy:334)
at gant.Gant.this$2$dispatch(Gant.groovy)
at gant.Gant.invokeMethod(Gant.groovy)
at gant.Gant.processTargets(Gant.groovy:495)
at gant.Gant.processTargets(Gant.groovy:480)

Bug or am I doing something wrong?

Steve CCRP

unread,
Dec 16, 2009, 4:31:26 PM12/16/09
to webdriver
I haven't used selenium much but selenium.type takes an element
locator (http://release.seleniumhq.org/selenium-remote-control/0.9.0/
doc/dotnet/html/Selenium.html)

So you need something like

type("name=name", "Dierk")
type("id=name", "Dierk")
etc.

Marcel Overdijk

unread,
Dec 16, 2009, 5:33:58 PM12/16/09
to webdriver
I also tried with: type("id=name", "Dierk") without success.

Danny Guerrier

unread,
Dec 16, 2009, 5:58:24 PM12/16/09
to webd...@googlegroups.com
Marcel when you specified type("id=name", "Dierk") you're telling selenium that you have an element with an html id of name i.e <input id="name" ..../> and you'd like to insert the string Dierk into it.

What you want to do is find out what the actual id of the element that you are trying to find is and use that to locate it.
If the id is 'username' for instance then you'd do this 
selenium.type("id=username", "Dierk");

--

You received this message because you are subscribed to the Google Groups "webdriver" group.
To post to this group, send email to webd...@googlegroups.com.
To unsubscribe from this group, send email to webdriver+...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/webdriver?hl=en.



Simon Stewart

unread,
Dec 16, 2009, 6:16:06 PM12/16/09
to webd...@googlegroups.com
Can you do a "jar tvf selenium-java.jar" and let me know if a file
called "injectableselenium.js" is present? The file name is
"org/openqa/selenium/internal/seleniumemulation/injectableSelenium.js"
It's there on my local builds, but that error suggests it's missing
for you. If it's there, which JVM and OS are you using?

Regards,

Simon

Marcel Overdijk

unread,
Dec 17, 2009, 3:24:30 AM12/17/09
to webdriver
Hi Simon,

The file is present in my jar.
I'm using JDK5 on Windows Vista.

Simon Stewart

unread,
Dec 17, 2009, 1:21:57 PM12/17/09
to webd...@googlegroups.com
And which JRE are you using? Sun's? IBM's? 5 or 6?

Looking at the stacktrace, the problem appears to be that we're unable
to load the "injectableSelenium.js" file as a resource from the
CLASSPATH. The two obvious causes are that the file is missing (which
isn't the case) or that the path we're loading from doesn't work for
whichever JRE you're using. The webdriver code has been tested on
Sun's 1.6 JRE and the OS X JRE on Leopard and Snow Leopard, but it's
possible that there's wonkiness caused by a different JRE.

Simon

Marcel Overdijk

unread,
Dec 18, 2009, 2:42:38 AM12/18/09
to webdriver
D:\Users\moverdijk>java -version
java version "1.6.0_11"
Java(TM) SE Runtime Environment (build 1.6.0_11-b03)
Java HotSpot(TM) Client VM (build 11.0-b16, mixed mode, sharing)

Same as webdriver has been tested on. Weird...

Andrew Hushbeck

unread,
Dec 18, 2009, 6:28:09 PM12/18/09
to webdriver
I am getting the same error, yet I do not seem to have the "org/openqa/
selenium/internal/seleniumemulation/injectableSelenium.js" file. I am
using maven to get the file and from the looks of it, it does not seem
to include any js files. Just class files, and injectableSelenium is
not one of the class files either.

If you are using maven, I would check your repo again and make sure it
is listed.

As far as my issue, this is a problem with the maven version of the
build I assume. Is there somewhere that I can file this as a bug for
the team managing the maven side of things or should I just file it
here?

Thanks,
Andrew

PS Sorry, I don't mean to hijack your topic here, it just happened to
be the exact problem I was having...

Simon Stewart

unread,
Dec 24, 2009, 1:57:50 PM12/24/09
to webd...@googlegroups.com
Hmmm... sounds like the selenium emulation JAR doesn't quite contain
everything it needs. *sigh* I don't use maven myself, but maybe one of
the other contributors might have some ideas.

Regards,

Simon

Simon Stewart

unread,
Dec 24, 2009, 1:59:28 PM12/24/09
to webd...@googlegroups.com
Following Andrew's email, are you using maven to build the project?

Regards,

Simon

Michael Tamm

unread,
Dec 30, 2009, 6:08:02 PM12/30/09
to webd...@googlegroups.com
Which dependencies to selemnium do you have in your pom.xml?

2009/12/19 Andrew Hushbeck <triskade...@gmail.com>

Tyoma

unread,
Jan 19, 2010, 5:30:01 AM1/19/10
to webdriver
I had the same problem using maven.

I've resolved this when added this dependency in pom.xml:
<dependency>
<groupId>org.seleniumhq.selenium</groupId>
<artifactId>selenium-server</artifactId>
<version>2.0a1</version>
</dependency>

Hope it helps.

On 31 дек 2009, 05:08, Michael Tamm <michael.ta...@googlemail.com>
wrote:


> Which dependencies to selemnium do you have in your pom.xml?
>

> 2009/12/19 Andrew Hushbeck <triskadecapho...@gmail.com>

> > webdriver+...@googlegroups.com<webdriver%2Bunsu...@googlegroups.com>


> > .
> > > > >> > For more options, visit this group athttp://
> > groups.google.com/group/webdriver?hl=en.
>
> > > > > --
>
> > > > > You received this message because you are subscribed to the Google
> > Groups "webdriver" group.
> > > > > To post to this group, send email to webd...@googlegroups.com.
> > > > > To unsubscribe from this group, send email to

> > webdriver+...@googlegroups.com<webdriver%2Bunsu...@googlegroups.com>


> > .
> > > > > For more options, visit this group athttp://
> > groups.google.com/group/webdriver?hl=en.
>
> > --
>
> > You received this message because you are subscribed to the Google Groups
> > "webdriver" group.
> > To post to this group, send email to webd...@googlegroups.com.
> > To unsubscribe from this group, send email to

> > webdriver+...@googlegroups.com<webdriver%2Bunsu...@googlegroups.com>

Reply all
Reply to author
Forward
0 new messages