3

Has anyone been successful with getting Selenium to issue a mouse click on an element which is not associated with input, i.e. plain text? I have tried using click() and click_at() methods, as well as fire_event(locator, event), where 'event' is 'onclick', or by using combination of 'onmousedown' and 'onmouseup' events. I have also tried preceding these events with an 'onmouseover' event. In my app, clicking on this 'plain text' triggers a call to a flash.swf routine. Thanks.

gmike
  • 46
  • 1
  • 5

4 Answers4

0

A native .click() event should work fine if your using Firefox 31.6.0 ESR (not a later version), or if your using Chrome. Keep in mind that for any event where a physical mouse click is not working for you (for whatever reason), you can still call a JavascriptExecutor to click the element (which is referred to as a synthetic non-native Selenium event).

djangofan
  • 28,471
  • 61
  • 196
  • 289
0

Have you tried adapting a Mouse Listener? In case you are extending Selenium using Java, here is a quick tutorial.

rs79
  • 2,311
  • 2
  • 33
  • 39
0

Have you tried fire_event(locator, 'click') instead of 'onclick'?

artbristol
  • 32,010
  • 5
  • 70
  • 103
0

Have you tried tweaking fire event? As you are mentioning it as plain text locator of this should be like //p[contains(text(),'yourtext')] something like this. Try it once.

Jason Plank
  • 2,336
  • 5
  • 31
  • 40
Karthi
  • 479
  • 2
  • 9
  • 21