Selenium webdriver takes 25 mins to identify and click an element - performance

This is Salesforce application with selenium Java.
Scenario:
Login to Salesforce with username, password and click on login
After that click on account tab in the Salesforce homepage.
Issue:
Salesforce login functionality is working fine. No issues.
After login to Salesforce it take 23 mins to perform the next action (click on Account tab link)
Here I used explicit wait of presence of element for 30 secs for the account tab link before click operation.
My script is not getting failed. I am not getting any timeout exception or no such element exception and my script is successful only after 23 mins (it takes 23 mins to identify element and click an element)
With same selenium code I tried with different Salesforce application but this time everything works as expected(after login I am able to click on account tab link). I never change the code. I just changed the application URL
I am thinking there might be an issue with application.but I am not sure about exact issue.
At least I should have received timeout or no such element exception
Or my script should have executed right after login without 23 mins of delay
I tried all the possible options like Page load strategy, fluent wait and explicit wait. Nothing works for me

If you are facing cannot read property 'defaultview' of undefined. Or
If you are unable to perform any actions on Salesforce homepage or
If selenium web driver takes much time to perform the actions in Salesforce home page or
If your script is working fine with debug mode and not in run mode, please follow the below steps:
Launch the Salesforce URL
Do not login immediately, this will create the above problems instead apply some wait ( Apply thread.sleep for 8 to 10 sec)
3)Enter username and password and click on login button
now you are all set. Your are good to perform any actions in SF home page.
Thanks!

Related

Cypress execute non stop first attempt when retry functionality is enable

Our application uses as login method Microsoft Azure OAuth2. As result when the user tries to open the application is redirected Microsoft Azure login page. This redirection caused to me an issue when a test failed and Cypress tries to re-executed. So, when the test failed then Cypress window is reload and lost the information that test executed already once. As result re-execute non stop the first attempt. Please for your help on that.
Cypress is focused in the testing of a single web page on purpose. But in your case it makes sense to trick cypress.
This must solve your issue: Access a new window - cypress.io

Laravel: difference between login with and without Remember Me option?

I have a question about the default Laravel Remember Me option below the login form. I use the default built-in LoginController.
When I read the Laravel documentation, then I read about the Remember option:
"which will keep the user authenticated indefinitely, or until they
manually logout"
Ok. Now I do a test:
I uncheck the Remember Me checkbox, and I login. Then I close the browser. I open my browser and goto my app: I am still logged-in.
Then I select the checkbox Remember Me, log in, close browser, open browser: exactly the same result: I am still logged-in....
How is that possible? What is the difference?
If you use remember me, Laravel puts cookie with token that is used to log you in next time you visit the page (in case you are somehow logged out I will explain later).
Laravel by default uses session that is valid for 2 hours (you can set this up in config), so if you close your browser while logged in and then attempt to open same browser again in window of 2 hours server will not notice the change.
"Log out somehow"
well obviously by clicking logout in application
clearing up browser cache by browser itself or by 3rd party program
using different browser (this is just for clarification)
using incognito mode (this is just for clarification)
using different computer and browser without sync feature (this is for clarification)
To answer your question "whats the difference?":
If you use remember me, Laravel will set cookie with token that is used instead of credentials (name:password combination) while logging in, and the process is invisible for user.
If you do not use remember me, you can be signed in only for 2 hours (or whatever is set in config file) without action. The fact that browser keeps session information even after its closed is considered as feature of the browser).

How to handle the logout process in jmeter?

I am using j meter to run the concurrent users.After login the application, I searched the files and finally logout from the application.I don't know to handle the logout process.Currently I created the 100 users.
100 users are logged into the application.
100 users are searched something.
100 users are needed to sign out.
How to do the third step. When I was recording the logout,there is no process are recorded.Could you please tell me the solution.
Usually logout is:
Associated with the relevant HTTP Request
Assumes clearing session data so if you have > 1 Loop on Thread Group level and using one of the following (or both):
HTTP Authorization Manager
HTTP Cookie Manager
Make sure you have Clear xxx on each iteration box checked
Logging out is a call just like any other- and it will be specific to your site. If you closed a browser tab or window, it's possible that you didn't actually log out from your site. It's also possible if you stopped recording too soon that you simply didn't record it.
I suggest manually adding it. You'll have to go into your Browser's Network Debugger to find the actual call that you're looking for, and then recreate it in JMeter.

session handling in struts 2

I am stuck with a session handling problem for past few days.
I am working on an application where an user logs into his account and can register there details or change them. How to manage sessions in this case. I mean how can i access the attribute of a session in different action classes?
Also when i click on log out and after that i press the back button given in the browser it goes back to the previous page and user can change their details which should not happen. Please help !!
The back button "issue" is because you have not disabled page caching.
Sessions data is available in actions via the SessionAware interface.
Sessions are per-user (more or less, actually per-conversation, and how that's implemented varies somewhat across browser versions), not sure what you mean regarding concurrent users.

Firefox extension to log out user after the page has been closed

I am writing my first FireFox extension and I have some questions. Maybe someone can help.
I have a website which requires login. The sign-in is one user per login type. So if I am logged with the username "tom" from one PC and go to other PC and try to login with the same details, it fails. When I click the log-out button from my authenticated page, the new location executes a PHP function to log-out the user (updates the "logged" status of the user in MySQL). The problem is that if a user is logged in from his work desk and surfing the page then suddenly he gets a call by a friend to quickly grab lunch in his break and has to meet him in short time, he just clicks the X (close) button from Firefox, forgetting to press the log-out button so the status of the logged is still 1. Later on, if he wants to access the page again from home, he won't be able to log in.
So, I need to grab the "close" event from firefox somehow. I am thinking about looking for the ones that contain the "website.com" domain only. Then, if a tab is closed or the main window of Firefox is closed, send an unique key, and the username to that URL that logs out the user and the problem may be solved. I don't know if this is possible. Please post any idea (followed by code if you can) for this extension to be built.
Thank you.
By design, this is wrong.
If a user's PC crashes (harddisk failure, power failure) your plugin won't be able to log out the user. And so, the user won't be able to login on any PC.
--
Let's revisit the premise,
a. why does logging in from another PC need to fail?
b. How about invalidating the login from the previous PC (log out) when the user logs in to another PC. THis is kind of like how chat applications like Yahoo! Messenger work.
From your answers, here's what i would suggest: if the user is logged in on another PC, warn and present the user with options:
cancel logging in
forcibly log out the other user and proceed to logging in
Logging the user out after a certain time of inactivity is the (application or web) server's responsibility, not (only) the client-browser's. This is called a session timeout.
You might be able to avoid the timeout by a browser implementation as you describe it, but this should not be the primary solution.
Here's an off hand approach you might take:
In your case I would include a timestamp in the table where the 'locked' state is stored. Every time a user does an action that timestamp is updated. When you try to login again ad the timestamp is older that a certain threshold (e.g. 15min) your login code should silently logout the previous user.
In order to receive a notice about the tab being closed, you'll want to do something like this sample code. However, instead of listening for load, you'll want to listen for unload.
When you do end up getting notified about unload, you'll have to do a request to the logout page just like the web application does. You can figure out what the location of the document that is unloading is by checking aEvent.originalTarget.location.href. Note that aEvent.originalTarget will give you the document object of the tab that is closing. You'll then want to use an XLMHttpRequest for this in your event handler.
You could use ajax that would ping a page on the site - all the session info will be passed and you can verify that the user still has an active browser/page open. If Firefox crashes it won't be able to ping the website anymore and the session could time-out after 15 minutes. I think that allowing a forced logout on another sign-in would be best. Usually when I leave work at the end of the day I wouldn't close all the programs or logout or anything - just lock my computer to prevent anyone from using it. Next morning I come back with all my programs still running so I can continue where I left off.
BTW, Yahoo Web messenger probably uses some form of session-based cookies. That is, cookies are stored in memory and are gone when the tab or browser are closed.
Just enable to the user to re-login from another machine. And if you get a request from the user on first machine, ask him to re-login too. So you get a single logged in user at a time.

Resources