1

How do you get source code of all the child elements of an HTML element that gets rendered by Javascript and is not visible in view source? (using selenium's php library)

Cœur
  • 37,241
  • 25
  • 195
  • 267
Robert Sinclair
  • 4,550
  • 2
  • 44
  • 46

1 Answers1

2

For example if it's an element with class name "ListTable" you would wait for your target element to load with

$driver->wait(10, 1000)->until(
    WebDriverExpectedCondition::visibilityOfElementLocated(WebDriverBy::className("ListTable"))
);

then get the content of the DOM inside this div class using:

$content = $driver->findElement(WebDriverBy::className("ListTable"))->getAttribute('innerHTML');
Robert Sinclair
  • 4,550
  • 2
  • 44
  • 46