Nothing happens on clicking links in chrome browser opened by Selenium - java

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

Related

Java button to open URL on chrome browser

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.

Selenium Browser profile is logging to SSO using default user details rather using passed credentials

Up until last last week my selenium UI tests were running successfully to log into system using SSO (with the test account details that I pass in the URL). If i don't pass the details it use to fail the test as there were no details entered in the auth popup. This is expected behaviour as Selenium will launch a New clean profile which doesn't have any stored details.
I'm always logged into the system hence when I normally open the browser manually the default profile is launched which logs me in automatically using SSO.
Now when I open incognito mode and try to log into the Site it asks for sign in details since the incognito mode doesn't have my details stored. this is also the expected behaviour
Since yesterday I noticed when I run the selenium UI tests it is ignoring the details I pass in the URL and keeps logging in as myself. I can confirm that it is using the new clean profile. I always delete cookies before launching browser
driver.manage().deleteAllCookies();
no code change happened since 2 week, and the test started failing since yesterday, So i cannot blame the code. Also this happens on Chrome and new MS edge. I cannot confirm on firefox since our organization doesn't support it.
I tried running the tests on other developer machine and result is same, the test were passing on their machine before but not now. I checked with the Security team and they confirmed they made no changes to SSO since a long time. not sure how to debug this. below are the things i tried from my side
Changed the system password twice - no luck
restarted win twice (hard turn off and turn on) - no luck
test works in Jenkins as expected since this was no default SSO in jenkins server(win server) stored.
can anyone please help to solve or actually understand the issue.
Browser - Chrome 86.0.4240.198 and Edge 86.0.622.69
selenium - 3.141
JDK - 1.8.0
OS - Win 10

WinAppDriver based automation stops working on windows 10 VM when I close the RDP connection

I am doing all the work remotely on my Windows 10 Virtual Machine (Via RDP). Whenever I am logged in to the server, I can see my automation running fine but when I close my RDP connection, the WinAppDriver can't find the elements on the desktop application and thus it stops working.
How can I solve it?
Please let me know If I am missing something.
Thanks
When you disconnect the RDP session windows knows it doesn't have the render the gui, so it doesn't.
The trick is to disconnect a different way. Terminate your connection from the remote sever with this:
%windir%\System32\tscon.exe RDP-Tcp#NNN /dest:console
where RDP-Tcp#NNN is the ID of your current Remote Desktop session, for example, RDP-Tcp#5. You can see it in the Windows Task Manager on the Users tab, in the Session column.
If you need more info have a look at this site https://support.smartbear.com/testcomplete/docs/testing-with/running/via-rdp/keeping-computer-unlocked.html
The link is for test complete not selenium but the steps are sound.

Start external VPN Software via Selenium

I am writing tests with Selenium. Before every test, I should open a VPN connection.
To do this, I should navigate to a website link, insert credentials, and when I click on Login, a pop up ask me to open the software on PC. Then it will connect automatically.
Manually with my browser, it works, but when I start the test, it click on Login, and then I get: "JRE" is not installed on your machine. Install "JRE" and retry.
I don't know how to do this.
How can I fix this?

connecting to the opened web browser using java selenium

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.

Categories

Resources