Selenium and xpath — locate an element using id attribute

Issue : Locate the fol­low­ing ele­ment using its ID.

<div id="globalContainer">
    <div>
        ...
    </div>
</div>

Res­o­lu­tion : You can write the fol­low­ing query in the browser console.

$x(//div[@id="globalContainer"])

Fur­ther Reading

You may also like...