문제

I am trying to run two testcases with multiple browsers

My XML

                  <?xml version="1.0" encoding="UTF-8"?>
                  <suite name="Same TestCases on on same machine on different Browser"  verbose="3"  parallel="tests" thread-count="2">
                  <test name="Run on Firefox">
                  <parameter name="browser"  value="*chrome"/>
                  <classes>
                  <class name="SeleniumGrid"/>
                  </classes>
                  </test>

                  <test name="Run on IE">
                  <parameter name="browser"  value="*iexplore"/>
                  <classes>
                  <class name="SeleniumGrid"/>
                  </classes>
                  </test>
                  </suite>

CLASS

                   public class SeleniumGrid {

public Selenium selenium;
@Parameters( { "browser" })
@BeforeClass
public void setup(String browser) {
    selenium = new DefaultSelenium("localhost", 4444, browser,"http://google.com");
    selenium.start();
    test_first();
    test_second();
}
@AfterClass
public void tearDown() {
    selenium.stop();
}
@Test
public void test_first() {
    selenium.open("/");
    selenium.type("q", "First");
    selenium.click("btnG");
}
@Test
public void test_second() {
    selenium.open("/");
    selenium.type("q", "second");
    selenium.click("btnG");
}

}

It runs without error and opens 1 iexplorer and 1 firefox browser

my GRID Hub SnapSot showing ACTIVE REMOTE CONTROLS : chorome & Internet explorer

but browser are just empty pages ,where I was expecting google.com page .

Any idea where i am wrong

Thanks

도움이 되었습니까?

해결책

selenium.open("http://google.com");

If it does not work try:

selenium.open("http://google.com");
selenium.open("http://google.com");

helped me with selenium in Opera.

If nothing works upgrade to WebDriver. Simplest solution.

다른 팁

I think the problem is that you aren't using anything to do your forking. What I do is create 2 test classes with 1 @Test in each one. then, I use Gradle-maxParallelForks or Maven Surefire-threads to fork test-runner processes. Also, TestNG can fork processes within one jvm and that works also as long as you set it to 'fork by classes".

라이센스 : CC-BY-SA ~와 함께 속성
제휴하지 않습니다 StackOverflow
scroll top