Testing multiple domains / urls at once

286 views
Skip to first unread message

Theo Chakkapark

unread,
Mar 24, 2009, 6:05:35 PM3/24/09
to selenium-users...@googlegroups.com
I have the following Selenium test script:

=================
<?php

require_once 'PHPUnit/Extensions/SeleniumTestCase.php';

class Login extends PHPUnit_Extensions_SeleniumTestCase\\ {\\ &nbsp; function setUp()\\ &nbsp; {\\ &nbsp;&nbsp;&nbsp; $this->setBrowser("*iexplore");\\ &nbsp;&nbsp;&nbsp; $this->setBrowserUrl("http://someurl.com);\\ &nbsp; }

&nbsp; function testLogin()\\ &nbsp; {\\ &nbsp;&nbsp;&nbsp; $this->open("/");\\ &nbsp;&nbsp;&nbsp; $this->click("//strong");\\ &nbsp;&nbsp;&nbsp; $this->waitForPageToLoad("30000");\\ &nbsp;&nbsp;&nbsp; $this->assertTrue($this->isTextPresent("Email"));\\ &nbsp;&nbsp;&nbsp; $this->assertTrue($this->isTextPresent("Password"));\\ &nbsp;&nbsp;&nbsp; $this->type("p_Email", "th...@notemine.com");\\ &nbsp;&nbsp;&nbsp; $this->type("p_Password", "somepass");\\ &nbsp;&nbsp;&nbsp; $this->click("//input[@value='&nbsp;&nbsp; Login&nbsp;&nbsp; ']");\\ &nbsp;&nbsp;&nbsp; $this->waitForPageToLoad("30000");\\ &nbsp;&nbsp;&nbsp; $this->assertTrue($this->isTextPresent("Create a Landing Page"));\\ &nbsp; }\\ &nbsp; \\ &nbsp; \\ &nbsp; \\ }\\ ?>

=================

I would like to test multiple URLs for the same script. For example, this test (and associated tests) are executed for one domain, shows results, then the next domain is picked out from an array of domain names, and the test runs for that domain and gives the results.

Can someone provide me with a list of things I need to do to accomplish this? I looked into the TestSuite class in PHPUnit, but the documentation didn't seem clear enough for me. Note that I have&nbsp;&nbsp;&nbsp;&nbsp; $this->setBrowserUrl("http://someurl.com), but ideally I'd like it to be&nbsp;&nbsp;&nbsp; $this->setBrowserUrl($url), but I can't pass parameters into setup(); doing setup($url) does not work.

Dima Kovalenko

unread,
Mar 24, 2009, 10:50:59 PM3/24/09
to selenium-users...@googlegroups.com
Sadly, the limitation of Java Script prevents the script from running across several domains. This is done for security reason so that someone won't be able to post a script on a different website and run it on a safe site. This becomes a somewhat of a problem since selenium is java script based.

But there are some good news, according to the wiki (http://wiki.openqa.org/pages/viewpage.action?pageId=763) IDE supports multiple domains, and there is experimental support for multiple domains in RC (not in Core though)

Here is some more info about running running RC in experimental mode
http://seleniumhq.org/documentation/remote-control/experimental.html
http://seleniumhq.org/documentation/tutorials/

This is all the resources i could find off the top of my head, hopefully it will send you in the right direction.


But yes, you are right there are almost nothing on this topic as most people got used to this limitation/security feature, so in short what you want to implement will probably be harder then worth the effort

Reply all
Reply to author
Forward
0 new messages