I'm trying to open a certain URL on Chrome upon button click in Java. But I'm not quite sure how. All the answers I found online is using the PC's default browser (Internet Explorer, most times).
How would it be done if I want the URL to be opened on Google Chrome?
You can use Selenium Web Driver for that. (https://www.selenium.dev/selenium/docs/api/java/org/openqa/selenium/chrome/ChromeDriver.html). But you shouldn't forget about the case when Chrome isn't installed on clients PC.
Related
I am currently using IE11 for my application.
My boss came up with the new requirement of making the application MS EDGE compatible.
I tried today by simply firing the URL on EDGE but it redirect me to IE and and opens the webpage for me on IE.
Can anyone please suggest how can i stop the redirection of URL from EDGE to IE, so that i can test the functioning in MS EDGE as well.
Will just changing the http-equiv="X-UA-Compatible" content="IE=edge" do.
You did not mentioned whether you want to use the MS Edge legacy browser or MS Edge Chromium browser.
I assume that you want to use the MS Edge Chromium browser.
I understand that when you try to visit the site in the Edge browser and site get launched in the IE browser. something like below.
This can happen if you have configured the Enterprise mode site list on your machine.
You can refer to the steps below to verify it.
Open Local group policy editor.
Browse to the location below.
Computer configuration -> Administrative templates -> Windows components -> Internet Explorer
Find and double click on Use the Enterprise Mode IE website list policy.
Check whether this policy is enabled or not. If it is enabled then try to note the location of the file list and try to access the file.
Modify the parameters for that specific site to let it access in the Edge browser.
If the site is an intranet site then the below policy also can cause the same behavior.
Open Local group policy editor.
Browse to the location below.
Computer configuration -> Administrative templates -> Windows components -> Internet Explorer
Find and double click on Keep all intranet site in internet explorer policy.
If this policy is enabled then for testing purposes try to set it disabled or not configured.
Similar kinds of policies is available for the MS Edge Chromium browser. You can also try to check it. whether they are configured or not.
References:
Configure using the Use the Enterprise Mode IE website list policy
Configure all intranet sites
If you are using the MS Edge legacy browser then try to check the set policies for it may help you to fix the issue.
I have some code written in selenium and using chrome driver. I am able to successfully run it and complete my flow when I run it from my system.
But, the flow fails when I try to run it from a remote system. I have the same selenium libraries and the same version of chrome browser and driver installed on the remote system as well.
The exact issue is that selenium opens the application and clicks on a link from a menu drop down. But nothing seems to be happening after it clicks. Nothing happens even when I try to click on the links on the selenium opened browser manually after the flow fails.
But everything works when I try to launch the browser manually from the same remote machine.
Please let me know what could the issue.
Guessing that you are probably running selenium 3.x and probably triggering through selenium remote server, try setting up the flag 'enablePassThrough' to 'false' like this,
java -Dwebdriver.chrome.driver=chromedriver.exe -Dwebdriver.gecko.driver=geckodriver.exe -jar "selenium-server-standalone-3.5.3.jar" -enablePassThrough false
More details here - https://github.com/SeleniumHQ/selenium/blob/ef44fef13349251c410a0d5357b8cd237a122f06/java/CHANGELOG#L20
Due to some reason ... i need to open the browser window manually and do some steps before running the script.
after running the script i want it to connect with that window only (manually opened).
p.s-since its manually opened .. cant pass the object of the WebDriver.
how can i direct my script to use that specific window.
somewhere found this-
driver = new RemoteWebDriver(newURL("http://10.0.1.10:4444"), new DesiredCapabilities());
Q1.how can found the this url "http://10.0.1.10:4444" which will work for me.
Q2. how will this driver know to go to firefox only and not chrome or IE. and to connect with particular tab and not the any other tab.
:- though i can keep only only one tab open in firefox.. Q2,second part for knowledge purpose only.
any kind of help will be highly appreciated.
Thanks
As you can see here
It is not currently possible to connect to a browser which is not opened by selenium.
What you can do is start the browser via selenium and then wait until you're done with your actions before continuing. Something like the following:
Start browser
Wait until element visible with long timeout
//Perform manual actions on browser
//Open page to test manually
//Testscript now executes because element at step 2 is found
WebDriver spawns its on own browser instance, it cannot work on already open browser window.
If you can mention what steps you have to manually do before starting the webdriver script then help can be provided on that.
I am trying to login to web outlook of test exchange server. Using selenium webdriver I am able to input the username , password and then click on the sign in button in web outlook. But after clicking there is no response in selenium neither throwing exception.No actions beyond the click will be performed.
But same scenario if I am running with HTTP instead of HTTPS, everything works fine.
Does it has to do something with IE settings? I have unchecked 'Warn about certificate address mismatch *" in Advanced section of Internet Options. This is done to bypass the SSL certificate error.
There may be few reasons.
1)Element may be out of focus. try focusing the element by using sendKeys(Keys.CONTROL).
2)There may be a page refresh happening or AJAX call when you are trying to click element. try using implicit wait until ajax call completes.
3)Website which you are trying to automate may be Siebel application(containing Active X Control)
When I hit the following web page, my required document is opened in a JAVA Applet:
http://a836-acris.nyc.gov/DS/DocumentSearch/DocumentImageView?doc_id=2004111600528001
I want to download the document which opens in the applet, the document could be of multiple pages. Is there a way to communicate with applet and fetch its content?
I've found a tool named Fiddler.
"Fiddler is a free web debugging proxy which logs all HTTP(s) traffic between your computer and the Internet. Use it to debug traffic from virtually any application that supports a proxy like IE, Chrome, Safari, Firefox, Opera, and more."
So when I opened the web page and document loaded in applet, Fiddler captured the internal requests made by applet to server which I was unable to see in browser and from there I got the direct URL to that document which I then used to download it :)