Some Eclipse Foundation services are deprecated, or will be soon. Please ensure you've read this important communication.

Bug 337548

Summary: SWTBotLink.click() seizes the mouse pointer and doesn't work with KDE as window manager
Product: [Technology] SWTBot Reporter: Geoff Bache <geoff.bache>
Component: SWTBotAssignee: Patrick Tasse <patrick.tasse>
Status: RESOLVED FIXED QA Contact:
Severity: normal    
Priority: P3 CC: patrick.tasse
Version: unspecified   
Target Milestone: 2.6.0   
Hardware: PC   
OS: Linux   
See Also: https://git.eclipse.org/r/84907
https://git.eclipse.org/c/swtbot/org.eclipse.swtbot.git/commit/?id=181984bbdb9a35c69abbd352107dfff179260859
Whiteboard:

Description Geoff Bache CLA 2011-02-18 05:56:50 EST
Build Identifier: M20100909-0800

The operation SWTBotLink.click() seizes my mouse pointer and moves it around and appears to be a much lower-level operation than most of SWTBot. Very little else in SWTBot seems to do this.

Also, it doesn't work with KDE at all (running RHEL5 Linux). When I call it there, it seems to click outside the window, causing it to lose focus and no further actions there to work.

I have tested though and it does work under Gnome or Xvfb on Linux. It also works on Windows.

Reproducible: Always

Steps to Reproduce:
1. Run KDE on a linux machine
2. Try to call SWTBotLink.click() on any link at all
3.
Comment 1 Geoff Bache CLA 2011-02-20 05:07:41 EST
After the rapid fix and release of bug 337527 (for which many thanks btw, really got me out of a hole) could I suggest the way to go with this one is to rewrite the method to find the hyperlink text and call SWTBot.click(hyperlinkText) which now works and isn't so low-level as to depend on window managers and their quirks?
Comment 2 Eclipse Genie CLA 2016-11-11 11:03:55 EST
New Gerrit change created: https://git.eclipse.org/r/84907
Comment 3 Patrick Tasse CLA 2016-11-11 11:34:26 EST
SWTBotLink.click() posts a mouse click event at the display location that corresponds to the center of the Link widget's bounds. It is possible, if the widget is in a parent composite or a shell that is too small, that this mouse location is over another control in the shell, or even over another shell, or no shell at all.

The proposed patch makes the click() method reliably click on the widget without posting mouse events, and select the first hyperlink, if there is any in the widget's text.

A new method click(int) is added to click and select the hyperlink at a specified index.
Comment 5 Patrick Tasse CLA 2017-04-12 14:57:39 EDT
Merged to master branch.