Skip to main content


Eclipse Community Forums
Forum Search:

Search      Help    Register    Login    Home
Home » Eclipse Projects » SWTBot » Unable to read SWTBotBrowser text content < Photon
Unable to read SWTBotBrowser text content < Photon [message #1795866] Mon, 01 October 2018 13:45 Go to next message
Julien HENRY is currently offline Julien HENRYFriend
Messages: 8
Registered: July 2009
Junior Member
Hi,

I have a view that contains a single Browser component. Content of the Browser is programmatically set using
setText(xxx)


I want to assert on the content of the Browser.

I'm doing:
bot.sleep(10_000); // This is more than enough to let the Browser render the content, in case it matters
SWTBotView view = bot.viewById("xxxx");
SWTBotBrowser browser = view.bot().browser();
System.out.println(browser.getText());


But the returned text is always blank, except on Photon (4.8). Putting a breakpoint, I can see in the UI that there is some actual content in the Browser.

When trying to debug, the variable SWTBotBrowser.widget is not accessible and says "Browser {*Wrong Thread*}".

Is it a known issue, or am I doing something wrong?

I tried on
Eclipse 4.6, 4.7 and 4.8
SWTBot 2.7
on Linux
GTK: 3.22.30
WebKit GTK: 2.22.0
Re: Unable to read SWTBotBrowser text content < Photon [message #1795869 is a reply to message #1795866] Mon, 01 October 2018 14:31 Go to previous message
Patrick Tasse is currently offline Patrick TasseFriend
Messages: 77
Registered: July 2009
Member
Hi Julien,

I'm not aware of any issues, but looking at this I notice that SWTBotBrowserTest is @Ignore...

Don't worry about {*Wrong Thread*}, that is how SWT toString() methods output when you are not in the UI thread, you are probably in a breakpoint in the test thread.

If you follow the implementation, eventually it invokes Browser.getText() using reflection and running in a UI thread runnable. This in turn calls WebKit.getText() which uses WebKitGTK native calls. Maybe try to put a breakpoint there.

Patrick

Previous Topic:Improve AbstractSWTBot.dragAndDrop capability
Next Topic:Run SWTBot test in Headless mode. RCP application is not started
Goto Forum:
  


Current Time: Fri Nov 27 07:23:04 GMT 2020

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

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

Back to the top