首页 > 解决方案 > 如何为这个硒的 HTML 代码找到一个元素?

问题描述

在此处输入图像描述

如何从此 HTML 代码中找到搜索框的定位器?我尝试了所有可能的方法,但没有运气。

标签: pythonseleniumxpathcss-selectorsrobotframework

解决方案


要定位元素,您可以使用以下任一Locator Strategies

  • 使用css_selector

    input.ant-input.ant-input-lg[placeholder='Enter aquestion']
    
  • 使用xpath

    //input[@class='ant-input ant-input-lg' and @placeholder='Enter aquestion']
    

推荐阅读