Hello all,
I'm being driven nuts by Selenium at the moment, I hope someone out there can help me.
My test run fine from the Selenium IDE, but not when calling it directly from Java code.
I know the problem is somewhere in my JS code. Specifically when making a calls to...
getElementsByName
and
getElementById
They both result in the method calls never returning.
I think its a combination of cross script browser problem & selenium starting up my app in a frame.
(and maybe Selenium trying to be smart and find my property in a sub frame and looping off to infinite)
I would love to use a JS debugger like Venkman, but its not enabled as a Add-on when Firefox is started up from Java.
So how do I enable it?
Thanks
Jeff Porter
Hello,
the thread title doesn't match your real problem, because it's about using prepared
Firefox profiles.
"-firefoxProfileTemplate <dir>: normally, we generate a fresh empty Firefox profile every time we launch. You can specify a directory to make us copy your profile directory instead."
as in http://selenium-rc.openqa.org/options.html.
Andras
p.s. It would be nice if you could use the search feature of the forum as this question has been posted very often.
Hi Andras,
Thanks for the response.
I did have a quick search for "firefoxProfileTemplate" but nothing came back.
Thanks for the advice though! You're a star.
Jeff
My final thoughts on my problem.
The problem occurs because Selenium starts my application in a frame when started from Java code.
My JS code trys to be smart an loop over all frames looking for a specific property. The code is...
currFrame.document.getElementsByName("synchronizeRequest")
In this case currFrame is "top", which is the Selenium master frame and I don't have crossdomain privilages to access this frame.
Trying to call getElementsByName causes a "Permission denied to get property" exception in the Javascript.
To solve this I have added an extra check. So that I catch the exception and carry on. i.e.
try {
// If window outside out domain, then except will occur. i.e. selenium frame.
currFrame.name;
} catch (err) {
return false;
}
synchroField = currFrame.document.getElementsByName("synchronizeRequest");
To debug the Javascript I set a program arguement in Eclipse when starting the Selenium Server.
The argument...
-firefoxProfileTemplate "C:/Documents and Settings/porterj/Application Data/Mozilla/Firefox/Profiles/nbyn5kon.default/"
I hope this information might help someone else out, or me in 6 months when I'm having a 'senior moment'
Thanks
Jeff Porter
You should not get this error if you use Selenium via Chrome (*chrome).
Andras
Hi Andras,
I thought I was.
TestClient.java
public void setUp() throws Exception {
setUp("http://localhost:8080/store", "*chrome");
}
Jeff