Versions Compared

Key

  • This line was added.
  • This line was removed.
  • Formatting was changed.

...

Selenium

Some Selenium tips

----

Anchor
field type in Derby
field type in Derby

...

Code Block
<!-- create a variable named uid that contains an unique identifier -->
<tr>
             <td>store</td>
             <td>javascript{(new Date()).getTime() % 10000}</td>
             <td>uid</td>
</tr>




Code Block
<!-- use of the variable named uid to fill a form entry -->
<tr>
             <td>type</td>
             <td>partyId</td>
             <td>user-${uid}</td>
</tr>


3) What is the difference between click and clickAndWait ? I would like to understand why I'm getting different behaviors from click and clickAndWait functions. Here is the scenario: I want to perform the login and then verify some text on the page (what should be pretty straight forward...) My first approach was  using the clickfunction + pause function. Something like below:

Code Block

<tr>

...


<td>click</td>

...


<td>submit</td>

...


<td></td>

...


</

...

tr><tr>
<td>pause</td>

...


<td>3000</td>

...


<td></td>

...


</tr>

The approach above worked fine and I was able to proceed with my test. However, I was looking the clickAndWait functionality and, per my understanding, this function should have a simlar behavior to my code above.. then I wrote the following:

Code Block

<tr>

...


<td>clickAndWait</td>

...


<td>submit</td>

...


<td></td>

...


</tr>

>
The code above is getting a "Permission Denied" message. I already check the URLs and I'm not launching a different domain (before I click I have http://domain/Login/Image Added and after the submission I have http://domain/App/).\\Image Added

I think the right solution is to use clickAndWait command instead of click+pause because it always success contrary to click+pause (we dont known the page response time). I see no reason why you don't observe the same behavior with clickAndWait. Maybe it's because your are testing the login page that can be a little tricky to test due to the session handling.

...

Code Block
<!-- Begin of standard login procedure -->
<tr>
 <td>open< <td>open</td>
 <td> <td>/manufacturing/control/logout</td>
 <td>< <td></td>
</tr>
<tr>
 <td>type< <td>type</td>
 <td>USERNAME< <td>USERNAME</td>
 <td>admin< <td>admin</td>
</tr>
<tr>
 <td>type< <td>type</td>
 <td>PASSWORD< <td>PASSWORD</td>
 <td>ofbiz< <td>ofbiz</td>
</tr>
<tr>
 <td>select< <td>select</td>
 <td>locale< <td>locale</td>
 <td>value <td>value=fr</td>
</tr>
<tr>
 <td>clickAndWait< <td>clickAndWait</td>
 <td>submitButton< <td>submitButton</td>
 <td>< <td></td>
</tr>
<tr>
 <td>assertElementNotPresent< <td>assertElementNotPresent</td>
 <td> <td>//div[@class='errorMessage']</td>
 <td>< <td></td>
</tr>
<!-- End of standard login procedure -->

...