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.
Related
I am trying to handle the following issue while trying to automate login process with JMeter WebDriver Sampler to our web app, which requests an authoriaztion certificate for a user to log in.
After filling credentials and clicking the Login button, the following window is called:
dialog window. I assume this is an OS window that cant be aimed by Selenium/WebDriver Sampler script - or is it possilbe?
EDIT: I found some solution e.g. https://sqa.stackexchange.com/questions/7640/how-to-select-security-certificate-from-security-dialog bit I am kind of afraid of implement the recommended code to the script - isnt there another solution then via Selenium script?
I tried to set a certificate in jmeter's system.properties file:
system.properties keystore setting.
I supposed it makes SOMETHING, e.g. some error after launching script, but it ends on the exactly same step - dialog window with Certificate choosing offer. So I assume this is wrong place to set user authentication certificate.
How is it possible to handle this kind of login process? I guess it is necessary to set a default certificate that is paired with the user's credentials I am sending in the previous step in my script, but I dont know where.
What you set in JMeter's "system.properties" file only affects the client certificates for HTTP Request samplers.
WebDriver Sampler is a different beast, it uses Selenium libraries to automate the real browser hence you need to follow your browser documentation to learn how to automate the certificate selection process.
For example for
Chrome on Windows it's in registry
for Chrome on Linux/Unix it's under /etc/chromium/policies/managed folder
More information: AutoSelectCertificateForUrls
I have invoked two apps from selenium. One browser window has customer app and the other agent app. Now, agent initiates a audio call to customer. The connection is successfull. I know connection is successful based on some new UI elements on agent side that show up. But, how do i verify if there is audio connection actually between these two browser windows using java code? Also, if i mute audio from agent side, how to make sure audio connection is now only one way, i.e from customer browser window to agent browser window and does not exist from agent window to customer window?
you can set volume value like this
JavascriptExecutor jse = (JavascriptExecutor)driver;
jse.executeScript("document.querySelector('locator').volume = 0.3;");
jse.executeScript("return document.querySelector('locator').muted");
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
I wanna run my test cases in headless mode, and I picked HtmlUnit is the way to achieve my requirement. But, the initial page where I need to handle windows based authentication box, and based on valid authentication it will take me to summary page of my application. We can able to handle the window based pop up by using Robot class, or AUtoIT but I'm not sure how that handled in headless mode. Can somebody help me on this? How do I bypass the authentication window in headless mode. I surfed and found there was some solution by using https://username:password#url, but it doesn't help me to fix my issue.
Note : I'm using Selenium JAVA libraries.
You can do it by using following code in selenium webdriver:
var alert = driver.SwitchTo().Alert();
alert.SetAuthenticationCredentials("username", "password");
alert.Accept();
Is there any way to inherit a session into webdriver? I did lot of search and know it that selenium does not support connecting to already opened browser. It would be better if i could. But now I have thought about some work around. Actually my application starts with a shortcut file which launch firefox, hit the application URL, made the log in, go to the dashboard and leave for the user to use it. In that case i do not need to work on that opened browser, if i can get that active session only and set it while opening the webdriver with selenium then my purpose is solved. Even its possible manually also. As selenium always open incognito webdriver window, i am unable to get that session there. Can any one tell me how to get that session from already opened browser and use it in webdriver? Any help or suggestion would be highly appreciated.
Selenium is just a server which accepts http requests using the json wire protocol. https://code.google.com/p/selenium/wiki/JsonWireProtocol
It's an http API.
Each call in the json wire protocol adds a sessionId parameter to the request.
So if you start a session using a driver, you can save that session ID and then instantiate a new driver object and give it the sessionId from before.
If the selenium server is still running that session, then it has no idea which driver object you are using when you send in a request. Feel free to have 100 drivers all with the same sessionID at the same time! :D