Selenium 1.0.1 won't properly click button element in Safari

45 views
Skip to first unread message

Powers

unread,
Jan 6, 2010, 12:23:59 PM1/6/10
to Selenium Users
I am experiencing an issue with Selenium RC 1.0.1 running on OS X
10.4.11 with Safari 3.1.1 whereby the element I am attempting to click
is a button element:

<button class="btn searchBtn" type="submit">
<span>Search</span>
</button>

I am identifying it using the xpath //button[@class="btn searchBtn"]
which I have verified is unique on the page. This works fine in
Firefox but does not work in Safari. Selenium reports that it clicked
the button with no issues, but the page does not get submitted
(reloaded).

09:12:02.079 INFO - Command request: isElementPresent[//button
[@class="btn searchBtn"], ] on session
cf078338a82840439a7ea7f7f72e47e4
09:12:02.085 INFO - Got result: OK,true on session
cf078338a82840439a7ea7f7f72e47e4
09:12:02.086 INFO - Command request: click[//button[@class="btn
searchBtn"], ] on session cf078338a82840439a7ea7f7f72e47e4
09:12:02.096 INFO - Got result: OK on session
cf078338a82840439a7ea7f7f72e47e4
09:12:02.099 INFO - Command request: waitForPageToLoad[120000, ] on
session cf078338a82840439a7ea7f7f72e47e4
09:14:02.212 INFO - Got result: Timed out after 120000ms on session
cf078338a82840439a7ea7f7f72e47e4

You can see that I am calling isElement present on this button and it
returns true. And you can see that Selenium can click the button
element and reports an "OK" return message. However, the application
under tests sits there as if nothing has happened. I have tried
putting a fireEvent("//button[@class='btn searchBtn']", "click") both
directly before and directly after the click call to no avail. I have
also used the span element within the button just for kicks, but of
course this has no effect either. I have also noticed that Safari is
throwing a "file doesn't exist" error in the Activity window which
when double-clicked reveals:

No file exists at the address "/tmp/
customProfileDir91e2600ec54246f7971c14448341126e/core/scripts/user-
extensions.js[91e2600ec54246f7971c14448341126e]".

But I am unsure if this is just a red herring or possibly related. I
have verified that I am an admin user on the Mac and that the profile
written to the /tmp directory has me as the creator/owner. I am unsure
what do to at this point so I have logged a Selenium ticket:
http://jira.openqa.org/browse/SRC-808. Any suggestions?

Powers

unread,
Jan 12, 2010, 9:58:26 AM1/12/10
to Selenium Users
Okay, I found a workaround for this issue. Since Selenium RC would
not properly execute the click or any of the fireevents on this button
in Safari, I used the submit( formLocator ) method. Now the page
reloads and the search is executed. I will leave the defect open in
Selenium's Jira so hopefully they fix this issue in a future release.

Cheers,
Powers.

On Jan 6, 10:23 am, Powers <powers.f...@gmail.com> wrote:
> I am experiencing an issue with Selenium RC 1.0.1 running on OS X

> 10.4.11 withSafari3.1.1 whereby the element I am attempting toclick
> is abuttonelement:
>
> <buttonclass="btn searchBtn" type="submit">


>      <span>Search</span>
> </button>
>
> I am identifying it using the xpath //button[@class="btn searchBtn"]
> which I have verified is unique on the page. This works fine in

> Firefox but does not work inSafari. Selenium reports that it clicked
> thebuttonwith no issues, but the page does not get submitted


> (reloaded).
>
> 09:12:02.079 INFO - Command request: isElementPresent[//button
> [@class="btn searchBtn"], ] on session
> cf078338a82840439a7ea7f7f72e47e4
> 09:12:02.085 INFO - Got result: OK,true on session
> cf078338a82840439a7ea7f7f72e47e4
> 09:12:02.086 INFO - Command request:click[//button[@class="btn
> searchBtn"], ] on session cf078338a82840439a7ea7f7f72e47e4
> 09:12:02.096 INFO - Got result: OK on session
> cf078338a82840439a7ea7f7f72e47e4
> 09:12:02.099 INFO - Command request: waitForPageToLoad[120000, ] on
> session cf078338a82840439a7ea7f7f72e47e4
> 09:14:02.212 INFO - Got result: Timed out after 120000ms on session
> cf078338a82840439a7ea7f7f72e47e4
>

> You can see that I am calling isElement present on thisbuttonand it


> returns true. And you can see that Selenium canclickthebutton
> element and reports an "OK" return message. However, the application
> under tests sits there as if nothing has happened. I have tried
> putting a fireEvent("//button[@class='btn searchBtn']", "click") both

> directly before and directly after theclickcall to no avail. I have
> also used the span element within thebuttonjust for kicks, but of

Santiago Suarez Ordoñez

unread,
Jan 14, 2010, 10:26:20 PM1/14/10
to seleniu...@googlegroups.com
Thanks for sharing.

Santi


--
You received this message because you are subscribed to the Google Groups "Selenium Users" group.
To post to this group, send email to seleniu...@googlegroups.com.
To unsubscribe from this group, send email to selenium-user...@googlegroups.com.
For more options, visit this group at http://groups.google.com/group/selenium-users?hl=en.




Reply all
Reply to author
Forward
0 new messages