Can someone please help me with the below selenium code-i am trying to validate whether a field or a radio box is enabled or not but instead of returning true or false . it is giving me a below message in console:
I am not sure what to do.just started learning selenium and stuck on every step
Basically my intention is to simply fill the form and click on radio button.
below is the website link-
please help me . I am stuck in my learning session because of this .
URL – https://testautomationpractice.blogspot.com/
package day26;
import org. open q a. selenium. chrome. Chrome Driver;
public class Practice {
public static void main(String[] a r g s) throws Interrupted Exception {
WebDriver driver=new Chrome Driver();
driver.get("https://testautomationpractice.blogspot.com/");
driver. manage().window().maximize();``
System. out. print ln (driver. get Current U r l ());
//String p g s r c=driver. get Page Source();
//System. out. print ln("Complete page source is listed below:" +p g s r c );
//driver. find Element(By. x path("//button[normalize-space()='New Browser Window']")).click();
//driver.getWindowHandles();
driver.findElement(By.xpath("//input[@id='name']")).sendKeys("Rock");
WebElement rb=driver.findElement(By.xpath("//input[@id='male']"));
rb.isEnabled();
System.out.println("Status is:"+rb);
rb.click();
System.out.println("click happened"+rb);
rb.isSelected();
System.out.println("rb is"+rb);
}
}
Console output- https://testautomationpractice.blogspot.com/
Status is:[[Chrome Driver: chrome on windows (48d0996f15a36fae8d911fcdbd7ef153)] -> x path: //input[@id=’male’]]
click happened[[(Chrome Driver: chrome on windows (48d0996f15a36fae8d911fcdbd7ef153)] -> x path: //input[@id=’male’]]
rb is[[ChromeDriver: chrome on windows (48d0996f15a36fae8d911fcdbd7ef153)] -> xpath: //input[@id=’male’]]
i was expecting a result in true or false
ashutosh rai is a new contributor to this site. Take care in asking for clarification, commenting, and answering.
Check out our Code of Conduct.