【问题标题】:I can not select list item in selenium我无法选择硒中的列表项
【发布时间】:2020-02-15 11:48:04
【问题描述】:

li 标签中的 selenium 脚本是什么。我在硒中使用了Xpath

driver.findElement(By.xpath(" //*[@id='select2-product_cat-container']")).click() ;

但它不起作用。

【问题讨论】:

    标签: java selenium qa


    【解决方案1】:

    html 中的 id 可以是动态的,因此您可以使用 xpath 中的text 来查找元素。
    你可以点击它:

    driver.findElement(By.xpath("//li[text()='Uncategorized']")).click(); 
    

    【讨论】:

    • 谢谢它的工作。
    猜你喜欢
    • 1970-01-01
    • 2020-01-11
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 1970-01-01
    • 2022-01-27
    相关资源
    最近更新 更多