javascriptjquerygoogle-chromeprotractorgoogle-chrome-console

Trying to get Inner Elements using chrome console javascript/jquery


Hi I am trying to get Inner Elements using chrome console, but it throwing me an error , Here is my code snippet . Any Workaround will really help me to get elements and automate it. I have attached a screenshot of a common website

When I do this I am getting the list of class element(i.e.swatches-wrap) as an Array.

$$(`.swatches-wrap`);

When I try this its throwing me an error Uncaught TypeError: $$(...)[0].$ is not a function

$$(`.swatches-wrap`)[0].$(`.title`);

Here is the attached screenshot enter image description here


Solution

  • $(".swatches-wrap")[0].querySelector(".info")

    you can chain it as well unless it is null:

    $(".swatches-wrap")[0].querySelector(".info").querySelector(".something")