0

I understand this might be a repeated question as I have seen some similar issues and solutions already provided. However, none of the tricks are working for me. Please if you can suggest how do I capture the highlight box in the below HTML - that would be helpful. Thanks in Advance.

HTML Code

IWebElement root = VU.Find(By.CssSelector("wc-doc"));
        Pause(5000);

        IWebElement Shadowroot1 = VU.getShadowRootElement(root);
        Pause(5000);

        IWebElement elem1 = Shadowroot1.FindElement(By.CssSelector("wc-spread"));
        Pause(5000);


    public IWebElement getShadowRootElement(IWebElement element)
    {
        IJavaScriptExecutor js = (IJavaScriptExecutor)driver;
        IWebElement temp = (IWebElement)(js.ExecuteScript("arguments[0].shadowRoot", element));
        return temp;
    }

The above method getShadowRootElement() is in a Library.

Pink_Rasp
  • 1
  • 1
  • dive, dive, dive into shadowRoots: https://stackoverflow.com/questions/71267809/how-to-select-element-tag-from-shadow-root/71269223#71269223 – Danny '365CSI' Engelman Oct 20 '22 at 19:32
  • I cannot get it still. Please help. – Pink_Rasp Oct 21 '22 at 16:58
  • Please add an executable StackOverflow Snippet to your post. It will help readers execute your code with one click. And help create answers with one click. See [How to add a StackOverflow snippet](https://meta.stackoverflow.com/questions/269753/feedback-requested-runnable-code-snippets-in-questions-and-answers) – Danny '365CSI' Engelman Oct 21 '22 at 18:13
  • Ok, I dont have a code as such.. I am only able to get to the tag (saved in root WebElement)- Could not even get the first div in 1st shadowroot after executing : IJavaScriptExecutor js = (IJavaScriptExecutor)driver; js.ExecuteScript("arguments[0].shadowRoot", element); – Pink_Rasp Oct 21 '22 at 19:47
  • @Danny'365CSI'Engelman I was able to post some code as well. Please could you help? Thanks in advance. – Pink_Rasp Oct 21 '22 at 22:56
  • This not native JavaScript, looks like a testing framework. Contact the vendor of the (testing) Framework – Danny '365CSI' Engelman Oct 22 '22 at 07:19
  • Thank you. Took some time but I was able to get it resolved. – Pink_Rasp Oct 22 '22 at 21:30

0 Answers0