Finding webelement with xpath starting with

前端 未结 3 1806
醉梦人生
醉梦人生 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:45

    Just install these addons: Firebug and FirePath in Mozilla Firefox.

    Go to the link in firefox, and invoke firebug by using F12 key.

    Then select the FirePath.

    Click the inspect element button and select the element. It will show the xpath of the element.

    Example:

     
    

    Xpath of the element will be

    //input[starts-with(@id, 'text-')]
    

    Then use it in java code.

    **Please do add comment, if the code works for you. It will help others to view the answer.**
    

提交回复
热议问题