Unable to read SWTBotBrowser text content < Photon [message #1795866] |
Mon, 01 October 2018 09:45  |
Eclipse User |
|
|
|
Hi,
I have a view that contains a single Browser component. Content of the Browser is programmatically set using
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 10:31  |
Eclipse User |
|
|
|
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
|
|
|
Powered by
FUDForum. Page generated in 0.02271 seconds