Skip to main content



      Home
Home » Eclipse Projects » SWTBot » clickLink fails if the linkText is too long
clickLink fails if the linkText is too long [message #490812] Sun, 11 October 2009 05:58 Go to next message
Eclipse UserFriend
Hello,

I have a link on my view. The link shows a path in my tree. If I click one one part of a link, then the entry in the tree will be selected.

I want to test this link-click.

The hyperlinks in the path are the id of the entry, that means they are short.
The test passes if the text of the several parts of the link are short.But if the are longer, then the function clickLink, clicks allways one the previos link part.

For example the linktext is
Quote:
"<a href="0">Root</a> / <a href="1">Part1</a> / <a href="5">Part2</a> / <a href="10">Part3</a> / <a href="13">Part4</a>";
That means Root / Part1 /Part2 / Part3 /Part4



Then the swtbotfunktion click link clicks the correct link.

But when the linktext is
Quote:
"<a href="0">Root</a> / <a href="1">Test20091011-1045</a> / <a href="5">Part1</a> / <a href="9">Part2</a> / <a href="17">Part3</a>";

Thaet means Root / Test20091011-1045 / Part1 / Part2 / Part3


If I then try to click in the test on part2, Part1 will be clicked.

Whats the problem?
Re: clickLink fails if the linkText is too long [message #492197 is a reply to message #490812] Mon, 19 October 2009 08:21 Go to previous messageGo to next message
Eclipse UserFriend
On 11/10/09 3:28 PM, Michelle Davidson wrote:
> Hello,
>
> I have a link on my view. The link shows a path in my tree. If I click
> one one part of a link, then the entry in the tree will be selected.
>
> I want to test this link-click.
> The hyperlinks in the path are the id of the entry, that means they are
> short.
> The test passes if the text of the several parts of the link are
> short.But if the are longer, then the function clickLink, clicks allways
> one the previos link part.
>
> For example the linktext is Quote:
>> "<a href="0">Root</a> / <a href="1">Part1</a> / <a href="5">Part2</a>
>> / <a href="10">Part3</a> / <a href="13">Part4</a>";
>> That means Root / Part1 /Part2 / Part3 /Part4
>
>
> Then the swtbotfunktion click link clicks the correct link.
>
> But when the linktext is Quote:
>> "<a href="0">Root</a> / <a href="1">Test20091011-1045</a> / <a
>> href="5">Part1</a> / <a href="9">Part2</a> / <a href="17">Part3</a>";
>>
>> Thaet means Root / Test20091011-1045 / Part1 / Part2 / Part3
>
>
> If I then try to click in the test on part2, Part1 will be clicked.
>
> Whats the problem?

Seems like the culprit is either SWTBotLink#extractHyperlinkTextOrHREF
or the click method that gets the wrong co-ordinates.

Can you:

1. do a getText() on the link to verify that you actually got the right
link ?
2. add a sleep before and after the SWTBotLink.click() to check if
swtbot is clicking on the right place -- it should click in the middle
of the link; and the location computation may be off.

--
Ketan
http://studios.thoughtworks.com/twist | http://twitter.com/ketanpkr
Re: clickLink fails if the linkText is too long [message #492226 is a reply to message #492197] Mon, 19 October 2009 10:12 Go to previous messageGo to next message
Eclipse UserFriend
Sorry, false thread. Please delete this post or ignore It.

[Updated on: Mon, 19 October 2009 10:28] by Moderator

Re: clickLink fails if the linkText is too long [message #492232 is a reply to message #490812] Mon, 19 October 2009 10:29 Go to previous message
Eclipse UserFriend
> Can you:
>
> 1. do a getText() on the link to verify that you actually got the right
link ?
> 2. add a sleep before and after the SWTBotLink.click() to check if
swtbot is clicking on the right place -- it should click in the middle
of the link; and the location computation may be off.

I have test this. (check the linkttext and insert a bot.sleep(5000) before the link.click("folder 1_1") for the link with a long linkpart and with only shorter linkparts

Here are my results.

The Link with the long name (root / test20091019-1536 / >folder 1 / folder 1_1 / folder 1_1_1

gettext() for this link:
Quote:
<a href="0">root</a> / <a href="5">test20091019-1536</a> / <a href="6">folder 1</a> / <a href="7">folder 1_1</a> / <a href="8">folder 1_1_1</a>


the link.click("folder 1_1") methode click on the linkPart folder 1 instead of folder 1_1. The bot clicks in the middle of the link part folder 1

The Link with the short name (root / test / folder 1 / folder 1_1 / folder 1_1_1)

gettext() for this link:
Quote:
<a href="0">root</a> / <a href="1">test</a> / <a href="2">folder 1</a> / <a href="3">folder 1_1</a> / <a href="4">folder 1_1_1</a>


the link.click(f"older 1_1") methode click on the linkPart folder 1 instead of folder 1_1. The bot clicks at the beginnung of the link part folder 1_1


That means the error does still exists.
Previous Topic:About chartcomposite
Next Topic:Use Junit 4.7 with SWTBot
Goto Forum:
  


Current Time: Thu Jun 19 00:20:35 EDT 2025

Powered by FUDForum. Page generated in 0.28687 seconds
.:: Contact :: Home ::.

Powered by: FUDforum 3.0.2.
Copyright ©2001-2010 FUDforum Bulletin Board Software

Back to the top