Selenium more than one baseUrl per test class
I am writing selenium scripts on a complex web based application.
To use a useraccount I need to register first using one URL and then approve the account in the admin console on another URL.
The problem is that there is another baseURL for registration and admin console and I need that in one unittest.
But when I use setBaseUrl in my tests it's ignored and the old baseURL is used. I even called start() after that, but no change...
Is there a trick that I am not aware of? I'm playing around and debug for quite some time on this problem, but the decoupled (test <-> RCServer) selenium tests are not making it开发者_C百科 easier to step through... ;-)
Since you tagged this selenium-rc, I assume you use rc.
Just use two separate selenium instances in the test client. There is no reason why you should have only one selenium instance within one class. That is even cleaner in my opinion since you are talking to two different user interfaces.
On the server side, you still need only one. The server will happily launch two browser instances if requested to do so using two client instances.
Moritz
edit: Just to add this, a now selenium instance can be created anytime with
Selenium s = new DefaultSelenium("localhost", 4444, "*chrome",
"http://your-target-url");
Assuming the selenium server is on localhost port 4444.
OK Selenium does not seems to be build for this kind of workflow.
I have split the test class in three test classes.
- Basic Registration using first baseURL
- Approval using seconf baseURL
- Simple tasks using first baseURL again
That's not as clean as having the stuff contained in one testcase because it belongs together from a business perspective. But at least it works and I don't have to hack selenium for it.
精彩评论