i'm facing the current problem: Since i'm under VPN, when i open a browser, a browser popup appears and ask me for the user and password credentials:
I need to open a browser in robot framework (firefox or chrome is the same) with a logged proxy.
I know that is possible to open a firefox instance with a proxy by using SeleniumLibrary Create Webdriver:
${proxy}= Evaluate selenium.webdriver.Proxy() modules=selenium, selenium.webdriver
${proxy.http_proxy}= Set Variable localhost:8888
Create Webdriver Firefox proxy=${proxy}
The problem is that it seems not possible to pass the credentials (user and password) for the proxy login.
Also, like most of the people suggest, i know that is possible to open the browser logged in with the proxy by using the url formatted like (in past i've also used that on different projects):
https://proxy_user:proxy_password#url_to_reach.com
but for some reason it doesn't work, i still have the browser popup asking me the credentials.
I've also tried by using Input Text Into Alert but it doesn't fill the alert fields:
Input Text Into Alert text=username action=LEAVE
I've also thought that maybe it is possible to do by using some preferencies with chrome or a profile with firefox but i've found nothing about this. Any other method by javascript?
Anyone can help? Thanks a lot
Related
In my web based application login form is window popup ,so that its not possible to automate using selenium webdriver , i have tried using robot class but didn't get the result, can any one suggest a solution for it.
if its authentication then you can try sending username password in URL. Also take a look at AutoIT for such cases.
EDIT: It depends on the type of authentication like HTTP / HTTPS so on and so-forth
One example can be this: https://serverfault.com/questions/371907/can-you-pass-user-pass-for-http-basic-authentication-in-url-parameters/371918
I am testing an application that requires login. Using SafariDriver when I click the "Keep Me Logged In" button every new SafariDriver instance that is created is automatically logged in as expected; but when I use FirefoxDriver or ChromeDriver I am asked for my credentials every time as if I've never logged to the site using that browser before (when I have both manually and using webdriver). Is there some setting I need to enable so FireFox and Chrome keep me logged in?
This happens because WebDriver creates a new FireFox profile for every session. These profiles include caches/bookmarks/plugins etc. for more information refer to the documentation. FirefoxDirver allows you to start a FireFox with a specific profile. This can be done by using the following code:
FirefoxProfile ff = new FirefoxProfile(new File("/Path/to/profile/directory"));
driver = new FirefoxDriver(ff);
I'll update the answer if I find the way to do this in chrome
Executing this code in Safari doesn't work, but it works in chrome and firefox:
var pathToFile = path.resolve('./scripts', file);
element( by.css('input[ng-file-select="onFileSelect($files)"]')).sendKeys(pathToFile);
In digging around it looks like it's not possible to interact with file inputs in this way in Protractor running on Safari. Does anyone know of a workaround in Safari to put a file path in an input?
This is due to a leaky abstraction, which requires a Safari specific solution:
I guess the workaround for those that really want to do file upload for SafariDriver would be not to do it natively via SafariDriver but by using external code libraries to perform the upload via HTTP/HTTPS (POST) requests (combining any other form data in addition to the file being uploaded/sent), then get response and check whether upload succeeded or not, then go back to SafariDriver code and navigate to next page to check upload succeeded or not, and/or to continue from there for the next steps in the automation.
This approach would be similar to the file download method using HTTP requests externally that has been mentioned in various posts in WebDriver and Selenium user Google groups. Here, it's just the inverse, doing upload instead of download.
Though if the upload requires a session (cookie), then you can extract Selenium session cookie and use with HTTP request. Or if session is stored with session ID in URL, extract that and pass along with HTTP request.
References
Selenium Issue 4220: The SafariDriver does not support file uploads
How to upload file using Selenium when the file input is hidden?
Access is denied error in IE while file uploading
Changing the value of input file
Chrome file upload bug: on change event won't be executed twice with the same file
Selenium IDE 1.4.1 throwing security error when uploading a local file
Dynamically submitting a file upload form in IE10 using jQuery
I'm trying to setup the config.php with my values but I get this fatal error:
Fatal error: Uncaught exception 'Google_AuthException' with message 'Error fetching OAuth2 access token, message: 'invalid_grant'.
I entered the client ID, secret, simple API key, location and sqlite database as the documentation says here:
https://developers.google.com/glass/quickstart/php
Any idea of what I'm doing wrong?
Thanks in advance!
This happens when the URL where you're hosting your Glassware is not listed as a valid OAuth 2.0 redirect URI on the API console. Follow these steps to resolve it.
First, determine your OAuth 2.0 redirect URI. This is where traffic goes at the end of the OAuth dance. The correct value depends on where you're running the php quick start. If you're running it on a local web server, it's likely to be http://localhost/mirror-quickstart-php/oauth2callback.php. If you're running it on example.com, it might be https://example.com/oauth2callback.php.
Go to the API console. This link will lead you to the right panel (services), but double check that you're on the correct project.
Scrolling down you should see a section of the page that looks like this: . Click on 'Edit Settings...'.
This triggers a pop-up where you can enter your OAuth redirect URIs. Add your redirect URI to the top text area. Make sure to put each URI on its own line.
Reload the page for the PHP Quick Start and everything should work.
If you're still having an issue, please share the full error message on the page and the value you have for the base url in config.php.
If you're getting the invalid_grant error from Google : Instead of using the client ID from google developer console as your value for client ID in the code, try using the email address value from developer console. This is actually what they expect. So, to confirm - the value for Client ID should be the value from developer console ending #developer.gserviceaccount.com
Had similar problem in Windows PS dotnet environment when trying to connect to DialogFlow Google Cloud Project recently and it appeared to be intermittent fault but it turned out to be global $env:GOOGLE_APPLICATION_CREDENTIALS in windows PowerShell was pointing to a key file set when first setup access to GCloud days before and since regenereated keys in GCP Console
After generating new key file and setting it with new generated key file using $env:GOOGLE_APPLICATION_CREDENTIALS="[Path_To_JSON_Key_File]" the problem went away but fix only lasted as long as the window was open, then after a while ran $env:GOOGLE_APPLICATION_CREDENTIALS on a newly opened PS window and noticed it was still pointing to the old key file!
setting the system environment variable GOOGLE_APPLICATION_CREDENTIALS to the value of [Path_To_JSON_New_Key_File] fixed it, all newly opened PS windows had the correct key file and authenticated correctly using Service Account and .Net Google Cloud API calls worked after that
I've set up my Silverlight WP7 app to use a WebBrowser Control to allow users to log into facebook and grant permissions for further actions. After the user has granted permissions, they are redirected to a web page letting them know permissions have been granted.
The chain is as follows:
App -> opens WebBrowser control at web service #1 -> web service redirects to FB -> Permissions granted -> FB redirects to web service #2 which returns a view.
Web services are both within an externally hosted MVC project.
This all works fine, UNLESS the user is not logged into facebook - instead of taking them to the facebook login page as you would expect, I just get an HTTP 500 internal server error and web service #2 is not hit. If the user is logged in, then everything proceeds as it should.
I'll also mention this ONLY happens on the WP7 device and does not occur in any browser, including IE9, on my laptop.
EDIT: For clarity's sake, Web browsers on my laptop were tested by setting a breakpoint before my WebBrowser control was called in Visual Studio, I grabbed the Uri I had built there, and pasted it into Chrome, IE9 etc.
I'm not even sure what direction to look in! Also, I'm sure you guys may need more details to aid you with this question - please let me know what else it is you might need and i'll do my best to provide it.
This code causes the problem.
// Constants.URL_FACEBOOK_LOGIN contains the parameter "display=touch|wap"
_popUpBrowser.Navigate(new Uri(Constants.URL_FACEBOOK_LOGIN));
This code fixes the problem.
// Constants.URL_FACEBOOK_LOGIN contains the parameter "display=touch|wap"
string userAgent = "User-Agent: Mozilla/5.0 (iPhone; U; CPU iPhone OS 4_1 like Mac OS X; en-us) AppleWebKit/532.9 (KHTML, like Gecko) Version/4.0.5 Mobile/8B117 Safari/6531.22.7";
_popUpBrowser.Navigate(new Uri(Constants.URL_FACEBOOK_LOGIN), null, userAgent);
Why?
Because Facebook currently has an issue with the Windows Phone 7 User-Agent value and the display parameter values of "touch" and "wap" when they are present in the same request. So simply sending in an alternate User-Agent header when using a WebBrowser control solves the problem for now.
I hope this helps other Windows Phone 7 developers that encounter the nasty 500 error when interfacing Facebook Graph API.
I've figured out the issue and have come to an undesirable solution - however, any solution is better than a HTTP 500 error.
The issue was with the Facebook dialog parameter "display". As my app is intended for the WP7, I have passed "display=touch" to Facebook when I check for permissions - however this WILL NOT WORK! I don't know why, but that was the cause of my error. When I took this parameter out I stopped receiving the error - however the full desktop style is used, which is undesirable.
It seems display=touch and display=wap both give me the HTTP 500 error. 'popup' and 'page' both work. I have not tested 'Iframe'. So for now I will stick to 'popup'.