selenium page object model: waiting for java script to complete - java

I'm using the selenium page object model to test a website. We have access to the sandbox PayPal account which allows us place test PayPal orders with a mock account.
My problem is on the sandbox PayPal login screen when I click login with the account I have created some java script (I'm guessing) displays an animation saying "Authenticating your information Logging you in"
When this happens my page fails because the is loaded() is expecting the url to be different but because the page doesn't start to load the next page until after this javascript completes the url is not correct.
I could stick a hardcoded wait for this login to take effect but does anybody know a better / proper way to handle this?

Related

How to automate multiple user login in selenium java?

I have a website where one user logs in and waiting for customer orders. There are five different users I need to automate the login part for all the users and need to wait with each user session. But when I tried to login this site with another user, website opens with previous user session. Is there a way with selenium java to done this automation (I am a beginner to selenium automation).
Thanks.
Include your browser initialization inside the login method. so every it will open a new browser and entering the credentials. please share your code samples for more info.

Need to check that user Login or not by using Browser Cache | Selenium Java

In my scenario, I've web page without any login panel. (i-e there's no account dashboard, usually other sites have at top right corner with user profile picture/name).
I've an email input field to enter email. And my page checks and shows a login button only if email is already registered in our database.
Then user logged in with his email and password, my page refreshes once with only some DOM changes and get user logged in to our system.
I'm running automation at 2 pages before this, but stucked here at 3rd page. I need to check this by browser cache/cookies because I havn't any other new element appeared at page.
Please help me. Is this possible to do? If not, then is there any other way to check this?
Thanks in advance to the responses.
I am using:
ChromeDriver 77.0.3865.40
Eclipse Version: 2019-06 (4.12.0) with Java
You don't need cookies in this case. Instead, you should property design your test case.
Before starting the browser, cookies should be cleared. Then you start your test, simulate normal login. Then navigate to the needed page. Now you know that the user was logged in and you know what to expect in your test.

How to connect android app to specific class in html code?

I'm going to make an Android app for my university that in my app's login page the user or student could type his/her student code and student password and by clicking "log in" the app takes him/her to his/her own portal on website!
I've watched many tutorials but all of them used JSON Parsing.
Our university website doesn't have JSON file so I want to try to connect to HTML code of log in page straightly and by the way university won't let me to connect to website database.
Basically I just want to know how to connect my app's login page to that login class of website HTML code!
Here is the webpage, you can see what I said here by just right clicking and selecting "view page source" in chrome:
http://puya.toos.ac.ir/gateway/PuyaAuthenticate.php
What you can do is , call the same page as you call http get service after getting the response , parse the html response.
For this specific case , you can login and track the script being called for login post request , call the same script by posting the required data as http post service . After authentication parse same result . Basically you will do all the parsing which browser do for you , and you have to present parsed data in meaning full manner .
You can also use webview for easy parsing and presentation.
Simulate your request by tracing every step of your website.

get from rally graph

I'm developing a Dynamic web Project in java, and the goal is upon click on button to fetch the "ITERATION BURNDOWN" graph from https://rally1.rallydev.com.
my question is do i have to know the rally api in order to get this content or just to go to the appropriate url and search there the graph?
i login successfully to the rally (used this link for the login: http://www.mkyong.com/java/how-to-automate-login-a-website-java-example/).
after i login successfully i couldn't get the url with the graph. it's just returning the landing page content.
pls help,
Thanks
I assume that you refer to IterationBurndown on Reports>Reports page, which is served by a legacy analytics engine.
To get the appropriate URL you may need to install IterationBurndown report wrapped in an app from AppCatalog on a custom page in Rally. I cannot confirm a java scenario, but the URL of that custom page can be used with javascript, by making an html file with this custom page embedded using iframe, for example:
iframe.src = "https://rally1.rallydev.com/#/12345d/custom/6789";
The steps are:
create a custom page
install IterationBurndown report from the AppCatalog as an app.
At least in the javascript app case, the URL to IterationBurndown on Reports page will not work for this purpose, hence the extra step of using a custom page.
When you say that you get a landing page, I am not sure if you are referring to login page or home page. If it is the former, it means authentication has not been handled. Legacy IterationBurndown report wrapped in an app will not work with newer ApiKey. That's too bad because ApiKey, unlike LoginKey, works with Java as well, unlike the legacy LoginKey which works in the browser (with html/javascript apps) only.

Submitting data to form and interacting with website, automation

Suppose I have a website that I can log into (at any time) and submit data to every x hours (click a link visible once logged in), how would I go about automating this process?
I have built a gui that provides the user (for now me, for my own convenience) an interface with some information, lets the user type in the log-in info and a button for starting a scheduled and repeated task in a ScheduledExecutorService but I am stuck at that point. Currently I use the Desktop api and browse() and rely on the user having logged in and just browse the url of the clickable link.
Knowing the URL of the loginsite, how do I submit the login info from my application to the the loginform of the website and let the website process it? (and let my app know the login was sucessful) and then click the link that will be visibile at a different URL once the login succeeds?
Looks like you need Web Services. Try exploring WSDL or REST api.
EDIT : Looks like you are trying to use Selenium which is a functional test framework. Set it up like the program describes at the end of the getting started page. After that you should be able to access the html page elements as provided in the tutorial.
If the webapp doesn't expose some kind of web service you cannot automate login procedure or any other action on the site.
If the website is your project, than you can implement web methods that allow you to achieve what you need.

Categories

Resources