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.
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.
> 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