Troubleshooting GWT with white (blank) screen - java

I'm using uiBinder and if I want to have Google Maps widget and suggestbox on the ui template I just get blank screen with nothing loading. Everything compiles OK. I have tested all the permutations in all the important browsers and it is the same thing everywhere.
Any idea on how to approach this in order to figure out what is breaking the javascript?

It possibly sounds like a runtime exception has been thrown before any UI controls were rendered.
As a simple test make the very first line in the client be a Window.alert(). If you get an alert box then run the app in the GWT Shell to see the ex stack trace. If you don't get an alert then the GWT app isn't loading. Try running in Firefox with FireBug's Net monitor enabled. This should let you see why the relevant JS files, etc aren't being loaded.

Having a nocache.js in the .html page that doesn't match the project creates a white screen. Try this if the alert code mentioned in this thread doesn't work.

Related

Selenium Web Driver click action

I have a code in selenium which dynamically clicks on the tabs in menu page. And sometimes happens that tab is not clickable(it is just a plain td with span inside) and when Web Driver tries to click on this tab, my program gets frozen (no exception thrown or anything).
I can't avoid clicking on tabs like that but I would like to somehow prevent that freeze after click. So can I set some timeout or tell to selenium what to do if element is not clickable?
driver.findElement(By.xpath(
format("//span[#class='rf-tab-lbl'][text()='{0}']",
navigation.getGroup()))).click();
//if the tab is currently selected (hence is not clickable) selenium won't click
// on it and program freezes
Please try another page from a different website. It might be a JS looping issue.
I encountered such an issue in HtmlUnit for some URLs.
I raised issue in HtmlUnit user group.
They told me that JS infinite loop was causing freez.
Time out did not work for me as well.
I tried to apply my own time out. That did not work too.
Refer following question for applying own timeout
HtmlUnit WebClient Timeout
If it works for another website, problem might be site specific.
You can attach source of Selenium in eclipse and check / debug where it is getting stuck.
I did same for HtmlUnit. I reached to parse method, which did not come out.
If still does not work, contact Selenium support.

Java Applet Printing dialog won't go away

I have a simple java applet that retrieves an image from a server and prints it out. The only problem is that I get the following java security warning:
Researching on this site and all over the web, some people suggest that I sign the applet (I tried that to no avail) and others suggest that I Modify a local java security setting but that isn't feasible for my clients.
Not only do I get this warning at the start of my applet, but seemingly any time the code attempts to interact with the printer, the dialog re-appears. Also, note that there is no checkbox next to 'Always allow this applet to access the printer'. These symptoms show on any browser.
How do I get java to respect the users choice to allow it to send jobs to the printer?
You might use the JNLP API services in a sand-boxed applet in a plug-in 2 JRE. They will still prompt the user each first time they go to print, but should also put an 'always allow' check-box on the dialog (though it really only applies for that run). See a demo. of the PrintService.
See also the applet info. page that includes a link on the Next Generation in Applet Java Plug-in Technology which "..brings new abilities to applets: such as .. allowing embedded applets to gain full access to the services of Java Web Start."

Pasting a Screen shot into a text area on a web page

Is it possible to take a screen shot (using the Print Screen) and paste it from the System Clipboard directly into a web pages text area field (which I would create)? Do I need a browser plug-in? Can Flash do this?
**The solution only has to work in Internet Explorer.
This is not possible without a plugin.
It's not possible in Flash or Silverlight either, although it is possible in AIR.
I think you will have to write a custom ActiveX Control in order to do this. The control should automatically take a screenshot and send captured image to server-side code..
There is one more option - create a java applet, which will do the job, and also will help you to avoid cross browser issue.

Applet is empty with absolute layout

I want to create a hangman game as an applet, so I have some labels and buttons that will be initialized by the generated code of the gui designer but I also have some labels I create on my own, after knowing how long my word is. Therefore I use absolute layout for my applet.
In netbeans my applet works finde when I run it but when I try to run it in the browser (I tried Firefox and IE) nothing is on the display, the applet is empty.
can someone help me with that?
Here you can find the source if it is helpful
http://root.xelluloid.de/Hedgeman/Hedgeman.java
With kind regards
Sebastian
Did you look at the Java console for the browser? It likely contains something that says that the program crashed because it could not find the AbsoluteLayout class.
This is for an older version of NetBeans, but the same should apply: http://forums.sun.com/thread.jspa?threadID=597783
I just had the same trouble with an applet and AbsoluteLayout and netbeans 7.1.
Everything works fine but errors are thrown when the applet runs from a browser.
I solved this by switching, in the form designer, from AbsoluteLayout to "Free Design" (which seems to default to GroupLayout in the code that is actually generated) but offers similar functionality (widgets can be placed without restrictions, borders, or even on top of others).
You could probably include the AbsoluteLayout Class/jar into your project and continue using this code. But in my case the code can't exceed 32KB and needs to be self contained (single file) as it needs to be uploaded to a small embedded device.

Testing onbeforeunload events from Selenium

I'm trying to write a Selenium test for a web page that uses an onbeforeunload event to prompt the user before leaving. Selenium doesn't seem to recognize the confirmation dialog that comes up, or to provide a way to hit OK or Cancel. Is there any way to do this? I'm using the Java Selenium driver, if that's relevant.
You could write a user extension (or just some JavaScript in a storeEval etc) that tests that window.onbeforeunload is set, and then replaces it with null before continuing on from the page. Ugly, but ought to get you off the page.
I've just had to do this for an application of mine where the onbeforeunload handler brings up a prompt if a user leaves a page while a document is in an unsaved state. Python code:
driver.switch_to.alert.accept()
The Java equivalent would be:
driver.switchTo().alert().accept();
If the alert does not exist, the code above will fail with a NoAlertPresentException so there is no need for a separate test to check the existence before accepting the prompt.
I'm running Selenium 2.43.0 but I think this has been doable for a while now.
In cases where I don't want the prompt to come up at all because that's not what I'm testing, I run custom JavaScript in the browser to set window.onbeforeunload to null before leaving the page. I put this in the test teardown code.
faced same problem with "beforeunlaod" event listner, LUMINUS! a chrome addon that helps me just block the event listener in the plugin thats all..
When I was confronted with limited control which I had over browser using Selenium, I turned to MozLab plugin which solved my problem if only for one browser platform.

Categories

Resources