Click Record Button at about:tracing through Selenium

I am trying to click the Record button through Selenium in Google Chrome. However I am not able to. Element is not found. I have tried using id and xpath. None of them worked.

WebElement record = driver.findElement("record-button"));;

The HTML code is

<template id="profiling-view-template">
    <button id="record-button">Record</button>
    <button id="save-button">Save</button>
    <button id="load-button">Load</button>
    <track-view-container id="track_view_container"></track-view-container>

Any lead will be appreciated.

1 answer

  • answered 2018-08-15 15:05 getThingsDone

    I am able to access that object by this

    WebElement root1 = driver.findElement(By.tagName("tr-ui-timeline-view")); WebElement shadowRoot1 = expandRootElement(root1); WebElement record1 = shadowRoot1.findElement("record-button"));;

    public WebElement expandRootElement(WebElement element) { WebElement ele = (WebElement) ((JavascriptExecutor) driver).executeScript("return arguments[0].shadowRoot", element); return ele; }