I am using Selenium and java and I cannot click on an element inside a modal. The scenario is this: after clicking on an item inside a frame, it opens up a modal and I need to c
As you are using the Selenium-Java
clients as per best practices the first and foremost trial must be with invoking the highly efficient and proven click()
method. Depending on the errors resulting out of click()
method we can work on other alternate solutions.
As I can see from your code trials with JavascriptExecutor
and switchTo().window()
, you havn't identified the WebElement
representing the SAVE AND EXIT
button well.
To click on the SAVE AND EXIT
button you can use the following code block :
new WebDriverWait(driver, 5).until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//div[@class='modal-dialog']//div[@class='modal-footer']//button[@class='btn modal-button full-btn' and @id='saveexit']"))).click();