NewRelic scripted browser interact with popup for login - selenium

Is it anyhow possible in new relic scripted browser to interact with a popup?
Is the following possible and if yes, how can I achieve the following?
Open url "https://sample.com"
Click button with id login
A popup opens
In popup fill username and password and click submit
Popup closes
Continue within application.
Basically the popup is the piece I'm struggling with. I searched documentation but was not able to find anything on how to interact with the popup.
Thx I really appreciate your expertise

This depends on what popup is defined as - a new browser window or an element embedded in a div or iframe? Either way, here are some solutions to either one:
Switching to a new browser window: https://github.com/newrelic/quickstarts-synthetics-library/blob/main/library/TabOrWindowSwitching/script.js
New Relic forum post containing several solutions/examples: https://discuss.newrelic.com/t/how-to-handle-intermittent-pop-up/38200

Related

How to get rid of google pop-ups while testing and navigation google url?

Every time I navigate to google through Selenium, I encounter this popup. I can't click on the search bar. Is there a way to close permanently this popup without using any JS alert method etc.?
I tried some extensions but it didn't work
Click the Lock button (🔒) on the top-left of the search box
Click on 'Cookies'
Make sure you're on 'allowed' and find anything on the lines of google.com
Click Block, Done and refresh the page
Additionally, you may want to try it first without the web-driver 'Chrome is being controlled by automated test software' mode, so open Google Chrome you way you usually would.

selenium UI testing is not able to fill the pop up window to enter credentials

selenium UI testing is not able to fill the pop up window to enter credentials. There were suggestions to use autoit tool to fill the pop window. But looking if it can be achieved by Selenium itself. Please suggest
You can bypass that authorization window that requires the user and password if you send them directly in the url like:
https://username:password#stackoverflow.com

How to identify Adobe flash player pop-up window using selenium for validation?

Is there a way selenium can identify and validate a Adobe flash player pop-up window?
say, you visit this site (http://sports.coral.co.uk/#) and click on "Coral Radio" submenu under Sports Menu. It opens a Adobe pop-up window. I can validate the presence of a pop-up window opening and close it, but I want to know if there is a way to assert on some content of that window? at least the title of the page before I close it?
Thanks for responding if anyone knows how to deal with this scenario.
To switch to a popup window, you need to use driver.getWindowHandles() and iterate through them. Then you can use driver.getTitle();
I've never found a way to get any content from Flash. I've heard something about automatic screenshots in headless mode, but then you have to check it manually probably again.

How to handle external applications in a selenium-test?

I am writing a test that verifies that a warning to the user before the user opens a document. If the user says that they still would like to open the document, the document opens in an external application (pdf or word).
But now I have an external application over the browser window, and it messes up for other tests.
So, what are the best practices around this kind of issue? Rewrite of the appliction to allow for not opening documents in test?
Added description:
The problem is twofold.
1) It starts processes (word and acrobat) that fills the desctop and requires resources from the test-slave
2) The external process seems to interfer with other tests since (guessing here) it is located over the browser window.
what i understood from your post is, the document(word/pdf) is opening in the browser window hence you are not able to proceed with further steps. If so, you can verify the Title to make sure the document is opened in browser window and can navigate back using below snippet.
driver.navigate().back();
Hope this helps.
What I understand from the line
'But now I have an external application over the browser window, and it messes up for other tests.'
is that once user clicks on open button a new window opens up (Window based application) since you have mentioned PDF or Word.
You can use robot class in such cases, below code snippet will close the current active window:
Robot rbt = new Robot();
rbt.keyPress(KeyEvent.VK_ALT);
rbt.keyPress(KeyEvent.VK_F4);
rbt.keyRelease(KeyEvent.VK_ALT);
rbt.keyRelease(KeyEvent.VK_F4);
Make sure you deal with sync issues properly so that intended window is closed instead of AUT.

New window opens with login screen while automating

I am facing below described issue while automating the application using selenium webdriver:
When I click on a link a new window should pen with the contents of that window, but when I click on the link new window is opening with login screen, what may be the issue, can anyone help me in this regard.
This issue is only with automation (manual click always works), but sometimes works.
Thanks in advance
Sounds like when a new window opens, all of the session cookies from the previous window are not being transferred. In this situation I would put a try catch block to login again if the login window appears.