为什么 XPath 没有突出显示 Chrome84 中的黄色标记? [英] Why XPath does not highlighted the yellow mark in Chrome84?

查看:26
本文介绍了为什么 XPath 没有突出显示 Chrome84 中的黄色标记?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

为什么 XPath 不突出黄色标记?我尝试在 ,省略第一个匹配的元素,突出显示其他元素.


Chrome v84.0.4147.89 中的错误

此问题是通过 命令为:

$x("//*[@name='q']")

  • 识别快照:

  • Why XPath does not highlight the yellow mark? I try to find the XPath at www.google.com

    //*[@id="fakebox-input"]

    It is found but not highlighted being the yellow mark on Chrome so it's hard for me to found out exactly where is the XPath and to see the XPath correct or not.

    Is there a solution to this issue?

    解决方案

    Here the major issue is with DevTools within Google Chrome 84.0 which doesn't highlights the first matched element.

    Incase, the locator finds a single match, the search result does show 1 of 1 but the WebElement is not highlighted within the DOM Tree

    As an example, the Search Box within the Google Home Page can be identified uniquely using the :

    [name='q']
    

    or using the :

    //*[@name='q']
    

    But within Google Chrome 84.0, does finds the element and shows 1 of 1 but the element is not highlighted.

    However, if there are multiple element matching to the Locator Strategy, leaving out the first matched element, the other elements are highlighted.


    Bug in Chrome v84.0.4147.89

    This issue was raised in the Platform>DevTools queue through Issue 1108311: The first matched element in the Elements panel is not getting highlighted as per the cssSelector and had been merged into Issue 1103316: Elements search does not resolveNode (highlight text, etc) on first search result where we are actively tracking the issue.


    Solution

    As per @bugdroid the main issue was caused because a check to ensure the search results were valid did not account for the case where the index was 0, so all highlight results of index 0 (index 1 to the user) were no longer highlighted.

    The fix for this issue is Merge-Approved in:


    Alternate Strategies

    You have two(2) other approaches as solutions as follows:

    • In the first approach, as per the article Fix site issues with the new Issues tab you can use the command document.querySelector() through the newly added Console tab within the second Drawer from the top to query the element through the css-selector as follows:

    • In the other approach, you can click on the Console tab, next to Element tab and execute the either of the following xpath/css commands:

      • command as:

        $x("//*[@name='q']")
        

      • Snapshot of identification:

    • command as:

      $$("[name='q']")
      

    • Snapshot of identification:

    这篇关于为什么 XPath 没有突出显示 Chrome84 中的黄色标记?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

    查看全文
    登录 关闭
    扫码关注1秒登录
    发送“验证码”获取 | 15天全站免登陆