Unable to click on a radio button in Selenium Webdriver

后端 未结 8 416
遥遥无期
遥遥无期 2021-01-23 21:11

I am learning Selenium Webdriver using Java. As a learning example, I tried to open MakeMyTrip, access International Flights page and click on One Way radio but

8条回答
  •  一整个雨季
    2021-01-23 22:05

    Use below code :-

        if(displayFlag==true && enableFlag==true)
        {
            try{
            Thread.sleep(5000);
            }
            catch(Exception ex)
            {
                System.out.println(ex.getMessage());
            }
            WebElement element=driver.findElement(By.xpath("//span[@class='radio_state']"));
            JavascriptExecutor executor = (JavascriptExecutor) driver;
            executor.executeScript("arguments[0].click();", element);
            System.out.println("Tried to click One Way");
        }
    

    enjoy .. get back to me if still getting any issue :)

提交回复
热议问题