Assertation by link text
See original GitHub issueIt seems like the elements() webdriver functionality has a strategy partial link text. So I assume it might be possible to build a assert function which finds a link with a specific text on the page.
As far as I can see, there is no such function.
Is there a plan to add such a function, or would you be happy if I tried to write such a function and then submit a pull-request? Or is the my desired functionality “check if there is an element with a specific text on the page” achievable in a different way?
Issue Analytics
- State:
- Created 7 years ago
- Comments:8 (3 by maintainers)
Top Results From Across the Web
How do I assert for a link's href AND link text in a functional test?
Perhaps a better approach will be assert by XPath selector \Drupal\Tests\BrowserTestBase::xpath something like '//a[@href="' . $url .
Read more >How to Test and Assert Link text is not on Page with Rails
This takes two arguments and searches for any anchor tags that contain the text "Edit Team" in them. If it finds it, the...
Read more >Find Elements With Link Text & Partial Link Text In Selenium
We will check two primary CSS locators in Selenium called link text & partial link text, as we perform automation testing with Selenium...
Read more >how do I assert that a hyperlink points to a given URL?
In my case though, I have multiple elements with the same text but want to avoid calling elments by xpath or dom. get_attribute...
Read more >Locate Elements by Link Text & Partial ...
linkText(). Accessing links using their exact link text is done through the By.linkText() method. However, if there are two links that have the ......
Read more >
Top Related Medium Post
No results found
Top Related StackOverflow Question
No results found
Troubleshoot Live Code
Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free
Top Related Reddit Thread
No results found
Top Related Hackernoon Post
No results found
Top Related Tweet
No results found
Top Related Dev.to Post
No results found
Top Related Hashnode Post
No results found

Thanks, I’ll update the documentation.
OK actually it looks like this is possible:
browser.expect.element('logout', 'link text').present;But it is not really documented as the documentation states the parameters should be exactly the other way around…