fix: RadioButton
This commit is contained in:
parent
7f54698e6e
commit
e04cec164c
@ -49,7 +49,7 @@ public class CheckBoxTest {
|
|||||||
driver = new FirefoxDriver();
|
driver = new FirefoxDriver();
|
||||||
}
|
}
|
||||||
driver.get("https://demoqa.com/checkbox");
|
driver.get("https://demoqa.com/checkbox");
|
||||||
//driver.manage().window().maximize();
|
driver.manage().window().maximize();
|
||||||
driver.manage().deleteAllCookies();
|
driver.manage().deleteAllCookies();
|
||||||
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||||
}
|
}
|
||||||
@ -63,7 +63,6 @@ public class CheckBoxTest {
|
|||||||
|
|
||||||
@AfterTest
|
@AfterTest
|
||||||
public void tearDown() throws InterruptedException {
|
public void tearDown() throws InterruptedException {
|
||||||
Thread.sleep(5000);
|
|
||||||
driver.close();
|
driver.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -0,0 +1,62 @@
|
|||||||
|
package zacksolutions.SeleniumPractice;
|
||||||
|
|
||||||
|
import org.openqa.selenium.By;
|
||||||
|
import org.openqa.selenium.WebDriver;
|
||||||
|
import org.openqa.selenium.chrome.ChromeDriver;
|
||||||
|
import org.openqa.selenium.firefox.FirefoxDriver;
|
||||||
|
import org.testng.Assert;
|
||||||
|
import org.testng.annotations.AfterTest;
|
||||||
|
import org.testng.annotations.BeforeTest;
|
||||||
|
import org.testng.annotations.Parameters;
|
||||||
|
import org.testng.annotations.Test;
|
||||||
|
|
||||||
|
import java.time.Duration;
|
||||||
|
|
||||||
|
public class RadioButtonTest {
|
||||||
|
public WebDriver driver;
|
||||||
|
|
||||||
|
@BeforeTest
|
||||||
|
@Parameters("Browser")
|
||||||
|
public void Setup(String browser) {
|
||||||
|
if (browser.equalsIgnoreCase("Chrome")) {
|
||||||
|
/*
|
||||||
|
ChromeOptions options = new ChromeOptions();
|
||||||
|
try {
|
||||||
|
driver = new RemoteWebDriver(new URL("http://192.168.1.215:4444/wd/hub"), options);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
System.getProperty("web-driver.chrome", "user.dir" + "/InterviewCodingQuestionsQA/Drivers/chromedriver");
|
||||||
|
driver = new ChromeDriver();
|
||||||
|
} if (browser.equalsIgnoreCase("FireFox")) {
|
||||||
|
/*
|
||||||
|
FirefoxOptions options = new FirefoxOptions();
|
||||||
|
try {
|
||||||
|
driver = new RemoteWebDriver(new URL("http://192.168.1.215:4444/wd/hub"), options);
|
||||||
|
} catch (MalformedURLException e) {
|
||||||
|
// TODO: handle exception
|
||||||
|
e.printStackTrace();
|
||||||
|
}
|
||||||
|
*/
|
||||||
|
System.getProperty("web-driver.gecko", ("user.dir") + "InterviewCodingQuestionsQA/Drivers/geckodriver");
|
||||||
|
driver = new FirefoxDriver();
|
||||||
|
}
|
||||||
|
driver.get("https://demoqa.com/radio-button");
|
||||||
|
driver.manage().window().maximize();
|
||||||
|
driver.manage().deleteAllCookies();
|
||||||
|
driver.manage().timeouts().implicitlyWait(Duration.ofSeconds(30));
|
||||||
|
}
|
||||||
|
|
||||||
|
@Test
|
||||||
|
public void RadioButton() throws InterruptedException {
|
||||||
|
driver.findElement(By.xpath("//div[@class='col-12 mt-4 col-md-6']//div//div[3]")).click();
|
||||||
|
String text = driver.findElement(By.xpath("//p[@class='mt-3']")).getText();
|
||||||
|
Assert.assertEquals(text, "You have selected Impressive");
|
||||||
|
}
|
||||||
|
|
||||||
|
@AfterTest
|
||||||
|
public void tearDown() throws InterruptedException {
|
||||||
|
driver.close();
|
||||||
|
}
|
||||||
|
}
|
||||||
@ -29,17 +29,18 @@ public class ToolsTextTest {
|
|||||||
@Parameters("Browser")
|
@Parameters("Browser")
|
||||||
public void Setup(String browser) {
|
public void Setup(String browser) {
|
||||||
if (browser.equalsIgnoreCase("Chrome")) {
|
if (browser.equalsIgnoreCase("Chrome")) {
|
||||||
|
/*
|
||||||
ChromeOptions options = new ChromeOptions();
|
ChromeOptions options = new ChromeOptions();
|
||||||
try {
|
try {
|
||||||
driver = new RemoteWebDriver(new URL("http://192.168.1.215:4444/wd/hub"), options);
|
driver = new RemoteWebDriver(new URL("http://192.168.1.215:4444/wd/hub"), options);
|
||||||
} catch (MalformedURLException e) {
|
} catch (MalformedURLException e) {
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
/*
|
*/
|
||||||
System.getProperty("web-driver.chrome", "user.dir" + "/InterviewCodingQuestionsQA/Drivers/chromedriver");
|
System.getProperty("web-driver.chrome", "user.dir" + "/InterviewCodingQuestionsQA/Drivers/chromedriver");
|
||||||
driver = new ChromeDriver();
|
driver = new ChromeDriver();
|
||||||
*/
|
|
||||||
} if (browser.equalsIgnoreCase("FireFox")) {
|
} if (browser.equalsIgnoreCase("FireFox")) {
|
||||||
|
/*
|
||||||
FirefoxOptions options = new FirefoxOptions();
|
FirefoxOptions options = new FirefoxOptions();
|
||||||
try {
|
try {
|
||||||
driver = new RemoteWebDriver(new URL("http://192.168.1.215:4444/wd/hub"), options);
|
driver = new RemoteWebDriver(new URL("http://192.168.1.215:4444/wd/hub"), options);
|
||||||
@ -47,10 +48,9 @@ public class ToolsTextTest {
|
|||||||
// TODO: handle exception
|
// TODO: handle exception
|
||||||
e.printStackTrace();
|
e.printStackTrace();
|
||||||
}
|
}
|
||||||
/*
|
*/
|
||||||
System.getProperty("web-driver.gecko", ("user.dir") + "InterviewCodingQuestionsQA/Drivers/geckodriver");
|
System.getProperty("web-driver.gecko", ("user.dir") + "InterviewCodingQuestionsQA/Drivers/geckodriver");
|
||||||
driver = new FirefoxDriver();
|
driver = new FirefoxDriver();
|
||||||
*/
|
|
||||||
}
|
}
|
||||||
driver.get("https://demoqa.com/text-box");
|
driver.get("https://demoqa.com/text-box");
|
||||||
driver.manage().window().maximize();
|
driver.manage().window().maximize();
|
||||||
@ -73,7 +73,6 @@ public class ToolsTextTest {
|
|||||||
|
|
||||||
@AfterTest
|
@AfterTest
|
||||||
public void tearDown() throws InterruptedException {
|
public void tearDown() throws InterruptedException {
|
||||||
Thread.sleep(5000);
|
|
||||||
driver.close();
|
driver.close();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@ -9,6 +9,10 @@
|
|||||||
<include name="TextBox"/>
|
<include name="TextBox"/>
|
||||||
</methods>
|
</methods>
|
||||||
</class>
|
</class>
|
||||||
|
<class name="zacksolutions.SeleniumPractice.CheckBoxTest">
|
||||||
|
</class>
|
||||||
|
<class name="zacksolutions.SeleniumPractice.RadioButtonTest">
|
||||||
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
</test>
|
</test>
|
||||||
<test verbose="2" preserve-order="true" name="TextFieldTextwithFireFox">
|
<test verbose="2" preserve-order="true" name="TextFieldTextwithFireFox">
|
||||||
@ -19,6 +23,10 @@
|
|||||||
<include name="TextBox"/>
|
<include name="TextBox"/>
|
||||||
</methods>
|
</methods>
|
||||||
</class>
|
</class>
|
||||||
|
<class name="zacksolutions.SeleniumPractice.CheckBoxTest">
|
||||||
|
</class>
|
||||||
|
<class name="zacksolutions.SeleniumPractice.RadioButtonTest">
|
||||||
|
</class>
|
||||||
</classes>
|
</classes>
|
||||||
</test>
|
</test>
|
||||||
</suite>
|
</suite>
|
||||||
@ -1,18 +0,0 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
|
||||||
<!DOCTYPE suite SYSTEM "http://testng.org/testng-1.0.dtd">
|
|
||||||
<suite name="All Test Suite" parallel="tests">
|
|
||||||
<test verbose="2" preserve-order="true" name="TextFieldTextwithCrhome">
|
|
||||||
<parameter name="Browser" value="Chrome"/>
|
|
||||||
<classes>
|
|
||||||
<class name="zacksolutions.SeleniumPractice.CheckBoxTest">
|
|
||||||
</class>
|
|
||||||
</classes>
|
|
||||||
</test>
|
|
||||||
<test verbose="2" preserve-order="true" name="TextFieldTextwithFireFox">
|
|
||||||
<parameter name="Browser" value="FireFox"/>
|
|
||||||
<classes>
|
|
||||||
<class name="zacksolutions.SeleniumPractice.CheckBoxTest">
|
|
||||||
</class>
|
|
||||||
</classes>
|
|
||||||
</test>
|
|
||||||
</suite>
|
|
||||||
Loading…
Reference in New Issue
Block a user