question-mark
Stuck on an issue?

Lightrun Answers was designed to reduce the constant googling that comes with debugging 3rd party libraries. It collects links to all the places you might be looking at while hunting down a tough bug.

And, if you’re still stuck at the end, we’re happy to hop on a call to see how we can help out.

Assertation by link text

See original GitHub issue

It 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:closed
  • Created 7 years ago
  • Comments:8 (3 by maintainers)

github_iconTop GitHub Comments

2reactions
beatfactorcommented, Oct 26, 2016

Thanks, I’ll update the documentation.

1reaction
matthiasfeistcommented, Oct 26, 2016

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…

Read more comments on GitHub >

github_iconTop 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 >

github_iconTop Related Medium Post

No results found

github_iconTop Related StackOverflow Question

No results found

github_iconTroubleshoot Live Code

Lightrun enables developers to add logs, metrics and snapshots to live code - no restarts or redeploys required.
Start Free

github_iconTop Related Reddit Thread

No results found

github_iconTop Related Hackernoon Post

No results found

github_iconTop Related Tweet

No results found

github_iconTop Related Dev.to Post

No results found

github_iconTop Related Hashnode Post

No results found