I am new to selenium automation and while learning radio button handling in selenium, I tried to automate language setting in amazon.in page. I am unable to select the radio button listed in the page.
site: https://www.amazon.in/customer-preferences/edit?ie=UTF8&preferencesReturnUrl=/&ref_=topnav_lang
code used: driver.findElement(By.xpath("//input[@value = 'ta_IN']")).click(); (I tried to select the language tamil- TA (3rd radio button)). Can anyone guide me in this?
public class seleniumTutorial2 {
public static void main(String[] args) {
System.setProperty("webdriver.chrome.driver","C:\\chromedriver.exe");
WebDriver driver = new ChromeDriver();
driver.get("https://www.amazon.in/customer-preferences/edit?ie=UTF8&preferencesReturnUrl=/&ref_=topnav_lang");
driver.manage().window().maximize();
driver.findElement(By.xpath("//input[@value = 'ta_IN']")).click();
}
}
'''
CodePudding user response:
try using this xpath://span[text() = 'TA']
driver.findElement(By.xpath("//span[text() = 'TA']")).click();
CodePudding user response:
Maybe try to click on //input[@value = 'ta_IN']/following-sibling::i