Question

I'm learning to use Robot Framework and Selenium2. I have to make some test on a website. But I have a problem. ^^

I'm doing test on logging. When I failed to log, I'm supposed to have a message on the page. So I try to test that the correct message appears.

The code looks like that :

<div id="col1">
<h1 class="layer-hdr">Msg</h1>
<p class="serverError">Message that I try to test :D</p>

...

So my purpose is to test with "Element Text Should Be" that my p is there and with the good msg.

I tried :

Login Should Have Failed
    Element Text Should Be  p.serverError   ${ERROR MSG}

But doesn't work :( Any idea ?

Thanks

Was it helpful?

Solution

Element Text Should Be    css=p.serverError    ${ERROR MSG}

Assuming that the first element to match that CSS selector is the element you want.

Element Text Should Be    css=#col1 p.serverError    ${ERROR MSG}

Might be better.

Check out http://rtomac.github.io/robotframework-selenium2library/doc/Selenium2Library.html and especially the locating elements part.

Licensed under: CC-BY-SA with attribution
Not affiliated with StackOverflow
scroll top