Finding webelement with xpath starting with

前端 未结 3 1795
醉梦人生
醉梦人生 2021-02-02 13:54

I\'m trying to locate a link using Selenium Webdriver. I don\'t wanna locate it by link text, only the actual link which is typed in . This can be done by using Selenium\'s find

3条回答
  •  失恋的感觉
    2021-02-02 14:42

    You can also use contains if you don't know what the href starts with:

    Link
    

    To find this link, you could use:

    By.xpath("//a[contains(@href, 'key_word')]"));
    

提交回复
热议问题