Warm tip: This article is reproduced from serverfault.com, please click

Text on Webpage is visible

发布于 2020-12-04 16:00:14

I am trying to make sure I have Element Text visible before I move onto the next step on my test. This is what I have tried: Element Text Should Be //<span class="quote__summary__level">public liability only</span> Public Liability Only because the text I want to make sure are visible on the page is Public Liability Only

I have also triend <span class="quote__summary__level">public liability only</span> Public Liability Only

But I am getting this error: InvalidSelectorException: Message: invalid selector: Unable to locate an element with the xpath expression //<span class="quote__summary__level">public liability only</span> because of the following error: SyntaxError: Failed to execute 'evaluate' on 'Document': The string '//<span class="quote__summary__level">public liability only</span>' is not a valid XPath expression.

What am I doing wrong please?

This is the element of the text on the website: <span class="quote__summary__level">public liability only</span>

Questioner
Mel
Viewed
0
PDHide 2020-12-07 23:54:22
Element Text Should Be    xpath://span[@class="quote__summary__level"]    public liability only

your locator is incorrect read how to locate element https://robotframework.org/Selenium2Library/Selenium2Library.html#Locating%20elements