java.awt.Desktop.browse() method issue - java

When we use Desktop.browse method to open a url in Internet Explorer, then it overrides the current web page in the browser. Hence if user was doing anything critical in current page in browser, then its all lost.
This does not happen in IE8 and firefox. But the problem is there in IE6.
Has anybody found a fix for this problem in IE6.

Change the settings in IE to open a new window.
As you pointed out the settings is available in
Tools->Internet Options->Advanced->Reuse Windows for shortcuts

Related

google colab error on google chrome browser - JavaScript files needed to display output

I am having below error while using google colab on google chrome. It started coming up suddenly
Error
Could not load the JavaScript files needed to display output.
This is probably because your Google Account login access has expired or because third-party cookies are not allowed by your browser.
Please reload this page.
I followed instructions from here using this page as some settings have changed. I have added [*.]googleusercontent.com in the section Sites that can always use cookies using the below instructions
On your computer, open Chrome.
At the top right, click More More and
then Settings.
Click Privacy and security and then Cookies and other
site data.
Next to "Sites that can always use cookies," "Always
clear cookies when windows are closed," or "Sites that never use
cookies," click Add.
Apart from that I have tried below steps:
The google chrome>>incognito mode and firefox browser runs fine.
I have already restarted my machine and cleared my cookies.
My javascripts seem to be enable as they are on the setting Sites can use Javascript
My google account is fully functional and not facing any issues with gmail or any other site
How could I resolve this issue?
Do you have too many cells open on your Colab that aren’t needed? Start a new notebook with just the cells you need or get rid of them.
Solution1: Disconnect your collab runtime and Restart your browser.
Solution2: Clearing cookies of last 24hours (and restarting the system) fixed the issue.
If anyone find any better approach, let me know.
There is an issue opened already https://github.com/googlecolab/colabtools/issues/757

How to attach a chrome window to a desktop application Selenium?

My problem is when I click on a desktop icon, it opens a link in already opened chrome browser in a new tab. How do I attach with the already opened browser and not a new one?
The below code returns a null because there is no window opened through selenium ofcourse, so yeah.
Set<String> windows = webdriver.getWindowHandles();
System.out.println(windows);
Any suggestions would be of great help. Thanks In advance.
There is no way to attach the chrome window that you've opened from the desktop application to your WebDriver instance.
If you want to be able to control a web page with a Selenium - you must pass your URL to a driver like that:
webdriver.get("https://www.your_link.com");
You might think about the way of getting and storing your URL as a variable and passing it into your code.
That would also be helpful if you add a bit more details about the problem. It's a bit unclear at what stage of the test you open the web page with a desktop application. Selenium can't be used to test desktop applications. Code sample of the test from your project would also help.

Ctrl+j does not open download page at chrome

I am using Selenium and Java to write a test for Chrome browser. I noticed that
action.sendKeys(Keys.CONTROL+ "j").build().perform();
action.keyUp(Keys.CONTROL).build().perform();
does not open download page on Chrome but works on Firefox.
why doesn't it work? and what would work on chrome too?
Follow this steps.
a) Press Ctrl-Shift-J (this will launch the chrome://inspector... window)
b) Change focus back on the PeopleSoft Page and then press Ctrl-Shift-J again. This will give the PeopleSoft page info.
If not according to knowledge cannot be customized keyboard shortcuts on chrome.
Try this ->
Open a new Tab and enter URL -> chrome://downloads/
This should solve your problem

Is there an alternate way to display NPAPI in chrome since chrome removed the NPAPI support?

I was using chrome to display my applet content. But now the support is removed from chrome. Please suggest if there is an alternate way to display applet content in chrome browser. Minimal change is appreciated.
The Oracle website (https://java.com/en/download/faq/chrome.xml) recommends that you either change your code to be a Java Webstart application, or get your users to change to Safari or Internet Explorer.
Please suggest if there is an alternate way to display applet content in chrome browser.
AFAIK, there isn't one.

How can I cause the browser to navigate to a given URL from a Java applet?

I have a Java applet consisting of a wizard-like form with three steps. At the final step, the user can click a "finish" button. I want that button to cause the web browser to navigate to a specific URL.
Question: Is there a way to cause the browser to navigate to a specific URL, in such a way that it will work across all modern browsers? My specific browser requirements are FF3+, IE7+, Safari 3+, and Opera 9+. I am using Java 1.5.
From the applet you can simply get the applet context and call showDocument(url).
This will navigate away from the current page to the specified URL:
getAppletContext().showDocument(url);
Additionally you can pass a target parameter.
To visit a relative URL you can use:
URL url = new URL(getCodeBase().getProtocol(),
getCodeBase().getHost(),
getCodeBase().getPort(),
"/next.html");
getAppletContext().showDocument(url);
These work in every major browser since Java version 1.1.
You could initiate the wizard from within JavaScript and have the applet return the execution flow to the JavaScript caller on clicking the 'Finish' button. Once you are in JavaScript you could then navigate to a new location, either by doing a form post or by doing changing the window.location property.
In the worst case, you could examine the use of LiveConnect, but I would touch it with a 10 foot pole.
Update on LiveConnect
The original LiveConnect seems to be limited by nature to browsers running on Windows, and will probably work only on NN and IE. Some of those bugs have been fixed recently, but browser compatibility will continue to be an issue.
If you're using Java 6 and above, see the Desktop API. That'll drive a browser. However I don't know if the applet security model will interfere with this.
Other than that, I've used BrowserLauncher2 with success. Similar caveats apply.
String googleURL = "https://www.google.com/";
try {
java.awt.Desktop.getDesktop().browse(java.net.URI.create(googleURL));
}
catch(IOException ex) {
Logger.getLogger(UI.class.getName()).log(Level.SEVERE,null, ex);
}

Categories

Resources