Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » swtbot find hyperlink(How can I find hyperlink ?)
swtbot find hyperlink [message #656362] Fri, 25 February 2011 04:54 Go to next message
shawn  is currently offline shawn
Messages: 9
Registered: February 2011
Junior Member
I just started study on swtbot several days ago
so I have many things not understand

I tried to find a hyper link with SWTWorkbenchBot
1. bot.link("label").click();
2. bot.link().click("label");
3. bot.link("label").click("label");

anyway I can't find it, (I don't the link ID .. and it's in a section widget)

I did searched in forum, but I didn't get any result that I can understand ... Sad

Could anybody do me a favor ?
Thanks a lot.
Re: swtbot find hyperlink [message #656942 is a reply to message #656362] Tue, 01 March 2011 00:53 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 2/25/11 1:54 AM, shawn wrote:
> I just started study on swtbot several days ago
> so I have many things not understand
>
> I tried to find a hyper link with SWTWorkbenchBot
> 1. bot.link("label").click();
> 2. bot.link().click("label");
> 3. bot.link("label").click("label");
>
> anyway I can't find it, (I don't the link ID .. and it's in a section
> widget)
>
> I did searched in forum, but I didn't get any result that I can
> understand ... :(
> Could anybody do me a favor ? Thanks a lot.

Could you provide a snippet of the stacktrace that you get ? Also it's
likely that what looks like a hyperlink is not actually a hyperlink. The
spy view(http://goo.gl/LzPT) can help you better identify widgets.

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot | @ketanpkr
Re: swtbot find hyperlink [message #657232 is a reply to message #656942] Tue, 01 March 2011 22:58 Go to previous messageGo to next message
shawn  is currently offline shawn
Messages: 9
Registered: February 2011
Junior Member
Here is the stacktrace ::

org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could not find widget.
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:348)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.widget(SWTBotFac tory.java:308)
at org.eclipse.swtbot.swt.finder.SWTBot.link(SWTBot.java:3491)
at org.eclipse.swtbot.swt.finder.SWTBot.link(SWTBot.java:3479)
at org.talend.tdq.swtbot.test.analysis.Test01.test1(Test01.java :26)
at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
at java.lang.reflect.Method.invoke(Unknown Source)
at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall( FrameworkMethod.java:44)
at org.junit.internal.runners.model.ReflectiveCallable.run(Refl ectiveCallable.java:15)
at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr ameworkMethod.java:41)
at org.junit.internal.runners.statements.InvokeMethod.evaluate( InvokeMethod.java:20)
at org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:76)
at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit 4ClassRunner.java:50)
at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java: 52)
at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :191)
at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 42)
at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java: 184)
at org.junit.internal.runners.statements.RunBefores.evaluate(Ru nBefores.java:28)
at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner. run(SWTBotJunit4ClassRunner.java:54)
at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r un(JUnit4TestReference.java:49)
at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test Execution.java:38)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:467)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe sts(RemoteTestRunner.java:683)
at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R emoteTestRunner.java:390)
at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main( RemotePluginTestRunner.java:64)
at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U ITestApplication.java:117)
at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work benchTestable.java:71)
at java.lang.Thread.run(Unknown Source)
Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException: Timeout after: 5000 ms.: Could not find widget matching: (of type 'Link' and with mnemonic 'Select columns to analyze')
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:398)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:372)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot Factory.java:360)
at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA ppears(SWTBotFactory.java:346)
... 32 more



the spy says, it is a hyperlink ...

and I took a look at the source code

public SWTBotLink link(String mnemonicText, int index) {
Matcher matcher = allOf(widgetOfType(Link.class), withMnemonic(mnemonicText));
return new SWTBotLink((Link) widget(matcher, index), matcher);
}

bot.link() is looking for a Link.class ?

Did I call a wrong method ?
Which method should I call ?

Thanks for your reply.
Re: swtbot find hyperlink [message #657383 is a reply to message #657232] Wed, 02 March 2011 11:06 Go to previous messageGo to next message
Ketan Padegaonkar is currently offline Ketan Padegaonkar
Messages: 873
Registered: July 2009
Senior Member
On 3/1/11 7:58 PM, shawn wrote:
> Here is the stacktrace ::
>
> org.eclipse.swtbot.swt.finder.exceptions.WidgetNotFoundExcep tion: Could
> not find widget.
> at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA
> ppears(SWTBotFactory.java:348)
> at org.eclipse.swtbot.swt.finder.SWTBotFactory.widget(SWTBotFac
> tory.java:308)
> at org.eclipse.swtbot.swt.finder.SWTBot.link(SWTBot.java:3491)
> at org.eclipse.swtbot.swt.finder.SWTBot.link(SWTBot.java:3479)
> at org.talend.tdq.swtbot.test.analysis.Test01.test1(Test01.java :26)
> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
> at sun.reflect.NativeMethodAccessorImpl.invoke(Unknown Source)
> at sun.reflect.DelegatingMethodAccessorImpl.invoke(Unknown Source)
> at java.lang.reflect.Method.invoke(Unknown Source)
> at org.junit.runners.model.FrameworkMethod$1.runReflectiveCall(
> FrameworkMethod.java:44)
> at org.junit.internal.runners.model.ReflectiveCallable.run(Refl
> ectiveCallable.java:15)
> at org.junit.runners.model.FrameworkMethod.invokeExplosively(Fr
> ameworkMethod.java:41)
> at org.junit.internal.runners.statements.InvokeMethod.evaluate(
> InvokeMethod.java:20)
> at org.junit.internal.runners.statements.RunBefores.evaluate(Ru
> nBefores.java:28)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit
> 4ClassRunner.java:76)
> at org.junit.runners.BlockJUnit4ClassRunner.runChild(BlockJUnit
> 4ClassRunner.java:50)
> at org.junit.runners.ParentRunner$3.run(ParentRunner.java:193)
> at org.junit.runners.ParentRunner$1.schedule(ParentRunner.java: 52)
> at org.junit.runners.ParentRunner.runChildren(ParentRunner.java :191)
> at org.junit.runners.ParentRunner.access$000(ParentRunner.java: 42)
> at org.junit.runners.ParentRunner$2.evaluate(ParentRunner.java: 184)
> at org.junit.internal.runners.statements.RunBefores.evaluate(Ru
> nBefores.java:28)
> at org.junit.runners.ParentRunner.run(ParentRunner.java:236)
> at org.eclipse.swtbot.swt.finder.junit.SWTBotJunit4ClassRunner.
> run(SWTBotJunit4ClassRunner.java:54)
> at org.eclipse.jdt.internal.junit4.runner.JUnit4TestReference.r
> un(JUnit4TestReference.java:49)
> at org.eclipse.jdt.internal.junit.runner.TestExecution.run(Test
> Execution.java:38)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
> sts(RemoteTestRunner.java:467)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.runTe
> sts(RemoteTestRunner.java:683)
> at org.eclipse.jdt.internal.junit.runner.RemoteTestRunner.run(R
> emoteTestRunner.java:390)
> at org.eclipse.swtbot.eclipse.core.RemotePluginTestRunner.main(
> RemotePluginTestRunner.java:64)
> at org.eclipse.swtbot.eclipse.core.UITestApplication.runTests(U
> ITestApplication.java:117)
> at org.eclipse.ui.internal.testing.WorkbenchTestable$1.run(Work
> benchTestable.java:71)
> at java.lang.Thread.run(Unknown Source)
> Caused by: org.eclipse.swtbot.swt.finder.widgets.TimeoutException:
> Timeout after: 5000 ms.: Could not find widget matching: (of type 'Link'
> and with mnemonic 'Select columns to analyze')
> at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot
> Factory.java:398)
> at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot
> Factory.java:372)
> at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntil(SWTBot
> Factory.java:360)
> at org.eclipse.swtbot.swt.finder.SWTBotFactory.waitUntilWidgetA
> ppears(SWTBotFactory.java:346)
> ... 32 more
>
>
>
> the spy says, it is a hyperlink ...
>
> and I took a look at the source code
> public SWTBotLink link(String mnemonicText, int index) {
> Matcher matcher = allOf(widgetOfType(Link.class),
> withMnemonic(mnemonicText));
> return new SWTBotLink((Link) widget(matcher, index), matcher);
> }
>
> bot.link() is looking for a Link.class ?
>
> Did I call a wrong method ?
> Which method should I call ?
>
> Thanks for your reply.

Allright. I should have read your email better. I thought Link was the
same as Hyperlink.

Long story short, Hyperlink is an extension to swt and part of eclipse
forms (sub)project. SWTBot currently does not have support for eclipse
forms (https://bugs.eclipse.org/id=283549).

What this means is that we the code that we have is not yet polished and
tested. But you can grab 2 classes code from github (http://goo.gl/hrbsP
and http://goo.gl/RWNEE) and submit bug reports and I'll push out a new
build in a couple of weeks with good hyperlink support to begin with :)

--
Ketan
http://ketan.padegaonkar.name | http://eclipse.org/swtbot | @ketanpkr
Re: swtbot find hyperlink [message #657501 is a reply to message #657383] Wed, 02 March 2011 21:45 Go to previous message
shawn  is currently offline shawn
Messages: 9
Registered: February 2011
Junior Member
Thanks for your reply
now I can find the hyperlink, it works well

SWTFormsBot.hyperlink("label").click();

so wait for your new build to have a good support for eclipse forms
thank you

Best Regards.
Previous Topic:How to get hover help in text editor?
Next Topic:java.lang.ClassCastException when running SWTBot tests in headless mode
Goto Forum:
  


Current Time: Thu Apr 17 23:32:31 EDT 2014

Powered by FUDForum. Page generated in 0.01727 seconds