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
  • 4

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
  • 26,842
  • 57
  • 182
  • 275
0

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

rs79
  • 2,291
  • 2
  • 34
  • 39
0

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

artbristol
  • 31,363
  • 5
  • 65
  • 99
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,342
  • 4
  • 32
  • 40
Karthi
  • 339
  • 2
  • 8
  • 21