Note that there are some explanatory texts on larger screens.

plurals
  1. POExecuting tests Concurrently on different OS and Browsers with WebDriver using Java and TestNG
    text
    copied!<p>I have configured grid in my system and written my test script. I can run my test on any specified OS and any Browser but only on one OS and one Browser at one time not all OS and all Browser simultaneously. Here is what I have done. Please tell me how can I configure it so that it can run in configured OS in one time.</p> <p>My Script using Java is below:</p> <pre><code>import java.net.MalformedURLException; import java.net.URL; import org.junit.AfterClass; import org.openqa.selenium.*; import org.openqa.selenium.remote.DesiredCapabilities; import org.openqa.selenium.remote.RemoteWebDriver; import org.testng.annotations.*; public class GridWithWebdriver { public WebDriver driver; @Parameters({"browser"}) @BeforeClass public void setup(String browser) throws MalformedURLException { DesiredCapabilities capability=null; if(browser.equalsIgnoreCase("firefox")){ System.out.println("firefox"); capability= DesiredCapabilities.firefox(); capability.setBrowserName("firefox"); capability.setPlatform(org.openqa.selenium.Platform.ANY); //capability.setVersion(""); } if(browser.equalsIgnoreCase("iexplore")){ System.out.println("iexplore"); capability= DesiredCapabilities.internetExplorer(); capability.setBrowserName("iexplore"); capability.setPlatform(org.openqa.selenium.Platform.WINDOWS); //capability.setVersion(""); } driver = new RemoteWebDriver(&lt;span class="IL_AD" id="IL_AD11"&gt;new URL&lt;/span&gt;("http://localhost:4444/wd/hub"), capability); driver.navigate().to("http://google.com"); } @Test public void test_first() throws InterruptedException{ Thread.sleep(3000); WebElement search_editbox = driver.findElement(By.name("q")); WebElement search_button = driver.findElement(By.name("btnG")); search_editbox.clear(); search_editbox.sendKeys("first"); search_button.click(); } @Test public void test_second(){ WebElement search_editbox = driver.findElement(By.name("q")); WebElement search_button = driver.findElement(By.name("btnG")); search_editbox.clear(); search_editbox.sendKeys("second"); search_button.click(); } @AfterClass public void tearDown(){ driver.quit(); } } </code></pre> <p>Testng.xml:</p> <pre><code>&lt;suite name="Selenium &lt;span class="IL_AD" id="IL_AD7"&gt;Grid with&lt;/span&gt; webdriver" verbose="3" parallel="classes" thread-count="2"&gt; &lt;test name="Selenium Grid Demo"&gt; &lt;parameter name="browser" value="iexplore"/&gt; &lt;classes&gt; &lt;class name="tests.GridWithWebdriver"/&gt; &lt;class name="tests.GridWithWebdriver1"/&gt; &lt;/classes&gt; &lt;/test&gt; &lt;/suite&gt; </code></pre>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload