1

Looking for way to pick elements with Selenide inside the document which is render using ReactJs.

I need to access xpath //h1/span[text()=' 1'] which is inside the document and Iframe. Is there a way to get that element and switch back to the main window?

Page contents look like below (Same page content in both images due to it being too long):

enter image description here enter image description here

2 Answers2

0

I'm able to succeed this using below method, Again but I got TimeoutException on time to time.

[1627896042.179][SEVERE]: Timed out receiving message from renderer: 30.000

 public WebDriver getFrame(){
    try {
        return Wait().until(frameToBeAvailableAndSwitchToIt(iFramePth));
    }catch (Exception ex){
        System.out.println("error in get Frame");
        ex.printStackTrace();
        return null;
    }
}

For that, I used the below method before calling to the above one. (Check Iframe is available)

iFramePthElement.should(Condition.appear, Duration.ofSeconds(TIME_OUT));

But even now it getting failed sometimes same error.
[1627896042.179][SEVERE]: Timed out receiving message from renderer: 30.000

0

To switch back to the main window, you can just do something like this:

      switchTo().parentFrame();

This will take you back out of the iFrame context and back onto the main site (or parent page).

As for the Timeout issue, I think this has been covered here: https://stackoverflow.com/a/60167733/9350566

Michael Dally
  • 195
  • 3
  • 12