I have a Sampler as below:
import org.openqa.selenium.*
import org.openqa.selenium.support.ui.*
import java.time.*
def user = WDS.browser.findElement(By.id('loginUserName'))
user.sendKeys('adminstafftest1')
def pass = WDS.browser.findElement(By.id('loginPassword'))
pass.sendKeys('STuser1225')
def login = WDS.browser.findElement(By.id('loginSubmit'))
def wait = new WebDriverWait(WDS.browser, Duration.ofSeconds(300))
WDS.sampleResult.sampleStart()
login.click()
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector('main-
body.application-unavailable')))
WDS.sampleResult.sampleEnd()
Once the login button is clicked, it needs to wait for the setting button to appear. Then, click on it.
However, am unable to make the script work as expected. i.e. After the login button is clicked, my script just times out throwing an error.
Attaching the screenshot.
I tried with
wait.until(ExpectedConditions.elementToBeClickable(By.cssSelector('main-body.application-unavailable')))
and
wait.until(ExpectedConditions.elementToBeClickable(By.id('settingsButton')))
But they don't make a difference. Am I missing something here?
Please help. Thanks for your support.
Regards,
Your By.id('settingsButton')
selector is fine, the reasons Selenium cannot find it could be in:
If you need comprehensive help you need to provide the page source, better in full as we cannot guess the reason by looking into partial screenshot. The page source can be obtained either using browser developer tools or by invoking WebDriver.getPageSource() function