I am using the latest version of selenium web driver and google chrome browser.
In my app, after clicking on login button while dom is getting loaded I get a popup
image
I just want to close this popup without entering any value. I am using java for scripting.
I tried javascript executor, all popup handlers from selenium but not able to close the same. I am not able to shift control on the popup window.
I google a lot but didn't found any relevant code
This is a default behavior when using HTTP basic authentication. To stop this window to come you would need to send user and password in the request. Or as I understand from other response I found about this you can write:
driver.get("http://UserName:Password#Example.com");
There seems to be a similar issue, going on in thread: How to handle authentication popup with Selenium WebDriver using Java
If all you want to do is "Cancel" the popup, instead of entering credentials. You may be able to just use this.
driver.switchTo().alert().dismiss();
using AutoID was able to resolve above issue.
Refernce: http://learn-automation.com/handle-windows-authentication-using-selenium-webdriver/
Related
I am trying to programmatically click a button in a web page using the command
document.getElementsByName("versionFile")[0].click()
while this command works fine in the developer tool console (opens the file selector) i am not able to execute this in script because it gives me a error saying "File chooser dialog can only be shown with a user activation" highlighting the click() function
Can anyone hep me out with this.
Most modern browsers restrict the JavaScript interactions not started by the user, to avoid annoying pages and make XSS a bit more difficult.
If you are using a web-scraping library like puppeteer, you should interact with the page using it's API (using page.click for example), not by injecting JavaScript on the page.
If that is not a option, you need to find the callback function that the button fires, and bypass the element.click() method.
My application has a payment card section inside of an iFrame. When running tests via TestCafe once the payment card form is submitted the form just gets stuck in 'processing' mode. As I'm trying to debug this issue I see that Chrome is blocking a redirect URL. I've tried to change my Chrome settings to allow all pop-ups but this is not adhered to when running via TestCafe.
So how can I set TestCafe browser to allow all pop-up? Is there a parameter I can pass when starting the test?
Could you send us a simple example of the page that shows the "Redirect blocked" warning when it's opened by TestCafe? This might be helpful for our further research.
As temporary workaround you can consider usage of User Profiles.
I'm using cheerio to scrape a web eCommerce pages, but the problem the page is blocking in an alert question if I click OK manually it pass well , how can I do that click automatically when the alert shown.
Probably you cant with cheerio.
https://github.com/cheeriojs/cheerio/issues/1226
Try to look projects like PhantomJS / JSDom or Selenium for browser automation and browser testing.
On my Flex/Actionscript app I'm using FB.login, which started giving me a blank popup after inserting credentials. On IE it still works, but from what I read, this is the cause:
Calling FB.login results in the JS SDK attempting to open a popup
window. As such, this method should only be called after a user click
event, otherwise the popup window will be blocked by most browsers.
I was thinking to show a Javascript popup and after user clicks on it execute FB.login and send data back to Actionsript. Will this work?
On Actionscript I'm simply executing:
Facebook.login(onLoginHandler,{perms:'friends_work_history'});
Now, how can I call JS and then get login data back on Actionscript?
If the blocker was the culprit, I think you wouldn't see the popup at all.
What's the structure of the code that gets the login status and then calls FB.login?
I had a similar problem. Turned out to be code in/around the FB.login callback that was causing the problem.
This is a good example of something (javascript) that works: http://developers.facebook.com/blog/post/2012/05/08/how-to--improve-the-experience-for-returning-users/
I use Silverlight and I'm trying to get some data to the user side. I can easily display PDF file with an <embed> tag in the browser.
However, I also have to be able to save files form the server. I tried the SaveFileDialog from Silvelright but it doesn't allow setting the file name (which is an issue).
I tried setting a hidden <iframe> source to the URL from the server but that triggers a security warning and it's not good either (there would be too many clueless users calling because it doesn't work).
I tried calling window.open to trigger a new popup set to the URL. That works OK but again there's a security warning.
Is it possible to get rid of that security message? I know it's possible in Javascript.
An exampel is on the site
http://livetecs.com
(go to the live demo, then project manager and open a report in a new window: no security warning!)
How do they achieve that behavior?
If there's any other way to get my reports saved Silverlight I'd be very interested to hear about them.
EDIT: The warning I'm talking about is the Pop-up blocked. To see this pop-up or additional options click here.. banner appearing on top of the page.
Cheers.
There is no way around the pop up blocker when you open up a window without a user action. If there was a way around that, than the pop up blockers would be useless.
Only way to avoid the security message is to have the users add your site to their safe list.
OK, after much fiddling I came accross the Silverlight built-in pop-up window that I couldn't use before.
The only limitation is that it can only be triggered by a user action (which is fine in this context() PopUpWindow at MSDN
It fits the bill perfectly and I couldn't use it before because I wanted to pre-generate the report files before opening the pop-up (and thus I wasn't in a user event context anymore).
I'm going to create a report generation page that will display a status message and then show the report (I haven't worked out yet how I'll do that though).