Menu
Automation Every Day
Home
Navigation
– Home
Friday, April 24, 2020
Selenium Practice :: Hidden Radio Button
9:50 PM
No comments
Handle Hidden Radio Box
Hidden elements
Male
Female
Lesbian
Normal Scenario
Java
C#
Python
Ruby
Hobbies
Singing
Coding
Code :-
Display Radio Buttons
Please select your gender:
Male
Female
Other
Please select your age:
0 - 30
31 - 60
61 - 100
Hradio_TC.java
package com.automation.aws.testing.test; import java.util.List; import org.openqa.selenium.By; import org.openqa.selenium.JavascriptExecutor; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.support.FindBy; import org.openqa.selenium.support.PageFactory; import org.testng.annotations.Test; import com.automation.aws.driver.Driver; import com.automation.aws.testing.page.Homepage_myBlog; public class Hradio{ JavascriptExecutor js = (JavascriptExecutor) driver @BeforeTest public void setUp() throws Exception { System.setProperty("webdriver.chrome.silentOutput", "true"); System.setProperty("webdriver.chrome.driver","./Library/chromedriver.exe"); driver = new ChromeDriver(); baseUrl = "https://automationeveryday.blogspot.com/"; System.out.println("Navigated to :- "+baseUrl); // Maximize the browser driver.manage().window().maximize(); driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS); driver.get(baseUrl + ""); } @Test(priority = 1) public void hradio_Btn(){ driver.navigate().to("https://automationeveryday.blogspot.com/2020/04/selenium-practice-hidden-radio-button.html"); // Homepage_myBlog hm = PageFactory.initElements(driver,Homepage_myBlog.class); Homepage_myBlog hm = new Homepage_myBlog(driver); hm.hradio(); } @AfterMethod public void tearDown(){ driver.quit(); } public void hradio() { try{ System.out.println("Title of Page :- "+driver.getTitle()); // WebElement radio_Male = driver.findElement(By.xpath("//*[@id='male'[2]")); boolean value = radio_Male.isEnabled(); System.out.println("Male Radio Button is Enabled :-"+value); if(value !=false) { radio_Male.click(); System.out.println("Radio button is Checked ? :- "+radio_Male.isEnabled()); } else System.out.println("Please Check Logs"); } catch(Exception e) { System.out.println("check Logs"); } } }
Email This
BlogThis!
Share to X
Share to Facebook
Newer Post
Home
0 comments:
Post a Comment
Popular
Tags
Blog Archives
Selenium Practice :- Drag and Drop
Drag the image into the rectangle:
(no title)
Test ...
Broken Image link
HTML Image
Selenium Practice :: Hidden Radio Button
Handle Hidden Radio Box Hidden elements Male Female Lesbian Normal Scenario Java C# Python Ruby Hobbies Singing ...
About Me
Sharad Rana
View my complete profile
Blog Archive
►
2022
(2)
►
July
(2)
▼
2020
(3)
►
June
(1)
▼
April
(2)
Selenium Practice :- Drag and Drop
Selenium Practice :: Hidden Radio Button
Powered by
Blogger
.
Blog Archive
►
2022
(2)
►
July
(2)
▼
2020
(3)
►
June
(1)
▼
April
(2)
Selenium Practice :- Drag and Drop
Selenium Practice :: Hidden Radio Button
Blogger templates
0 comments:
Post a Comment