How to automate Salesforce application using Selenium Webdriver with Java? - java

Trying to automate the salesforce application but it has verification code after logged in and couldn't able to find any solutions to automate verification code.Tried using cookies for existing browser session but couldn't able to automate
as it is always opening the salesforce application in new session.Kindly provide any other valuable solutions on this.

You can add your IP to whitelist in Security Controls -> Network Access and the verification code step will not be appear anymore to your pc.

Related

Is there any way to handle authentication alert using selenium without any OS tool like autoIT and robot

I am facing authentication pop up for a webpage:
for now take it as example,
https://test.com
what I have tried
https://username:password#test.com
but it is not logging in. the pop again comes and asks for login credentials.
Issue
I have to run the script headless so I don't want to use AutoIT, Robot, is there other way to handle this?
This is called Basic Authorization and solved by injecting header with authentication data. What you have tried used to work before but then it was considered insecure so such form of authentication is no more supported.
Selenium does not have native mechanism to address that but you can use BrowserMob-Proxy in order to add header data from your Selenium test.

How to hide that browser is under SeleniumWebdriver control

Is it any way to do it ? I have automated script which searches through website with captcha and I noticed that if I open this website manually there is only "I'm not a robot" checkbox but when I open it using selenium there are also several puzzles to solve so server must recognize that my browser "is being controlled by automated test software" as Chrome says.
I tried to use incognito mode but it doesn't help.
The main goal of Captcha is: an application to prevent unauthorized access and automated accessing of the websites using any tools/bots. Selenium(or any Automation Tool) cannot read CAPTCHAs.
So, if y can, mock this service in the staging/test environment.
Also, Captcha is an outside service.
It's not necessary to test Captcha behavior, right?
However (as for everything, a hack is available), you can use some software/websites to convert ‘image to text’ (which would be not ‘always’ correct!)
Another thing, we can set cookies for Captcha. The secret key for captcha should be used in this case.

How to handle Site Guard of Drupal website in Selenium?

The dev website on Drupal has Site Guard. I am trying to automate the website using Selenium but each time it is asking for Site Guard credentials to be entered. I treated it as regular alert but it seems not to be working.
I'm not sure if Siteguard is a software or a service, anyways I think that what you are trying to do is not in the Drupal side, if the development site has some kind of protection, then you must configure that protection, to let you Selenium test to do its work... What about configure Siteguard to not bother a certain IP? Or maybe some cookie?
Hope that helps.

Java: How to access Window credential from IE browser

How can I retrieve the credentials for the currently logged-in Windows user that accessing my web application in java
From a standalone application, I can access the user id of a logged-in window user using
com.sun.security.auth.module.NTSystem NTSystem = new com.sun.security.auth.module.NTSystem();
System.out.println(NTSystem.getName());
However, this will not work for web app, since it will always print out the id of the user that running Tomcat, not the id of the user who accessing the web application
I see this being done before, that if I access a website via IE, it automatically log me in, but I use other browser, then a log-in box pop out. Any idea how to achieve this, thank you?
My web app is written in JSF with Tomcat 7.
You need to use a library that can receive the Kerberos token that IE will sent (assuming that it is configured with Integrated Windows Authentication).
There are multiple approaches/libraries to doing this, which are well documented on Apache's site for Tomcat. Here you go: http://tomcat.apache.org/tomcat-7.0-doc/windows-auth-howto.html
You have some different options to achieve this. Tomcat has some suggestions on their homepage. I've used both IIS fronting and the spring-security kerberos extension and they work just fine.

Secure Gmail login on web browser from external Java program

Is there a secure way of logging into a Gmail account on a web browser, from an external Java program? I know the following works, but is there a safer alternative?
Desktop.getDesktop().browse(new URI(
"https://www.google.com/accounts/ServiceLoginAuth?continue=http://mail.google.com/gmail" +
"&service=mail&Email=LOGIN&Passwd=PASSWORD&null=Sign+in"));
Clarification: The external Java program is GmailAssistant, a Gmail notifier that already uses the IMAP capabilities of JavaMail. I just need a way of allowing the user to access the account directly in a web browser.
Depending of how much you want to integrate, you can check Google single sign-on (SSO) api. I'm studing how to use it and the best way to integrate it
http://code.google.com/apis/apps/sso/saml_reference_implementation.html
Victor
UPDATED:
As a better option, you should check this link as well http://esoeproject.org/
If you're really wanting to control a browser from Java, you'll have to use a web-connector such as Selenium or WebDriver. Both of these let you control a browser directly from within Java and simulate a user typing text, clicking on links and submitting forms. One thing to keep in mind when doing this with Selenium is that it interacts with a complete new profile which is usually independent of your standard Firefox probile.
If you are afraid that the link is visible in the Page, create a javascript document that sends a POST request to the server.
If you want to programmatically access the content of a GMail account, I would strongly suggest to use the IMAP access provided by Google.
Looking at the question the other way around, you can setup an OpenID authentication scheme based on your Google account.
I used google's IMAP access with the JavaMail API, and it was very simple.
If you're worried about the URL being sent for the login, understand that:
https:// starts with www.google.com and will encrypt the session before
sending the login details (or even the page it's going to

Categories