0

I have tried below code:

if(webElement2.isDisplayed()) {
            webElement.explicitWaitToClickElement(4,webElement);
            webElement2.click();
}

String tagContent = (String) ((JavascriptExecutor) 
BrowserUtilities.getDriver()).executeScript("return arguments[0].innerText;", webElement2);
  • 2
    Please update your question with the error you're seeing. – anonygoose Feb 5 '19 at 13:06
0

Your code does the following:

  • If webElement2 is displayed, wait for some other element, webElement, to be visible and click on webElement2;
  • Grab the text on webElement2.

It can be failing because webElement2 is never displayed.

Probably, what you want is:

  • If webElement2 is not displayed, click on webElement (not webElement2);
  • Wait for webElement2 to be visible;
  • Grab the text from webElement2.

OBS: I will edit this answer based on @anonygoose's request.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.