Search code examples
htmlgoogle-chromexpathgoogle-chrome-devtoolsweb-inspector

How to stop jumping to xPath hit on search - Chrome Inspect Elements


In my work I write a lot of locators to elements on websites. So I will inspect the element and then manually construct an xPath matching it.

What is driving me crazy is that when using the ctrl+f search bar to construct/verify the locator it jumps to the first element as soon as it gets any sort of match. So if I start writing '//div' and is intending to continue it, it still jumps to the very first div in the code and the element I was trying to construct a locator for disappears from view. Or I will have to start constructing it from the back etc just so it won't find a match until I am done, which just complicates it.

Is there any way of disabling the automatic search? So that it only does the match when pressing enter, or something similar. I have looked through the settings but can't find any way.

Please help, it is driving me insane.


Solution

  • Was running into this same issue and found something that might help.

    In Devtools > Settings > Preferences > Global > "Search as you type" checkbox.

    Just uncheck that setting and the selector won't match until you hit Enter.

    For more context, check out the chrome documentation page about this: https://developer.chrome.com/docs/devtools/dom/