16

Well, I believe you cannot prevent deletion of Session data once you close the browser. But, you can store the cookies of your first instance and copy it to new instances using a driver.manage().getCookies() method. Before calling driver.close() method in your test, make sure to save the cookies using following piece of code : Set<Cookie> allCookies =...


9

This is how I would debug a Selenium session to find out what is happening: Step-by-step debugging: Most IDE's allow you todo step-by-step debugging, you could set a break point just before the point you want to investigate. This will pause the execution of the test and lets you examine the browser with its own tools. You can step thru each line of code one ...


9

You can try setting implicit wait time. (Documentation) // 5 seconds implicit wait (C# code) IWebDriver driver = new FirefoxDriver(); driver.Manage().Timeouts().ImplicitlyWait(TimeSpan.FromSeconds(5));


5

Probably because you close the browser at the end of each test. Which is good because then you test in isolation. But now the session's data is cleaned. Each new Selenium browser starts with a new clean session in order to not influence new test runs with older cookies and such. If you want to re-use the current session, only close/quit the browser at the ...


3

I think it should be the other way around, letting the test hand it over to a manual users for a while: Start the Selenium test to open browser and goto CAPTCHA page Write a wait that waits for an element that would be shown after the CAPTCHA is completed. (Make sure this wait has a large timeout, maybe also enlarge the default timeouts. Be sure to reset ...


2

@siva prasad: Did you use wait in your script?, if not please use below code may solve your problem. If not please paste your code so we can look into it. driver.manage().timeouts().implicitlyWait(30, TimeUnit.SECONDS);


2

Have you tried setting EnsureCleanSession to true? DesiredCapabilities cap = new DesiredCapabilities(); cap.setCapability(InternetExplorerDriver.IE_ENSURE_CLEAN_SESSION, true); OR cap.setCapability("ie.ensureCleanSession", true); When set to true, this capability clears the cache, cookies, history, and saved form data. When using this capability, be ...


2

I don't quite get why you would like to share browser session. UI test methods should be run in the own independent browser. In case you insist, you could use @BeforeClass of TestNG and have driver set up done in @BeforeClass method. Now both of your methods should be either in this class or class with extends the set up class. Confused? This might help - ...


2

Single Sign-On is a very broad term and testing it will much depend on how it has been actually implemented in your project. In short Single Sign-On provides you a way to authenticate at one place (Identity Provider) and access multiple systems (Service Providers) without the need to re-authenticate. Your SSO implementation may allow to authenticate at ...


2

Apparently not possible at the moment (or in the near future from the tone of the following statement). From https://developer.apple.com/documentation/webkit/about_webdriver_for_safari: One Session at a Time, to Mimic User Interaction Only one Safari browser instance can be active at any given time, and only one WebDriver session at a time can be ...


1

Firstly, this is maybe be a smell that your application is not built with a testability mindset. In the Automation environment: 1 - This feature should be removed; or 2 - The user should be automatically log by sending a token generated uniquely by the application, identifying therefore the user. There are ways of working around the issue, but this way ...


1

Single sign on(SSO) implementation needs to be validated in combination with manual testing as well as with automation testing. Functional validation: Need to test the application manually to ensure that the functionality of the application is working as expected. To confirm the SSO, test with two separate logins to understand and confirm the behavior of ...


1

If you run the tests on your local machine, just make sure the test-code does not call driver.quit(); or driver.close(); or driver.Dispose();. For example by commenting it out and running only one test. The browser should stay open at the end of the test. The default browser idle timeout is 30 minutes, this means you should be able to keep working in that ...


1

You did not specify a client operating system, but here is an idea for Linux. Using cgroups, you can constrain how much CPU a process (or group of processes) can use. Here is the idea. Cgroups (short for Control Groups) is a Linux facility for constraining the resources used by a process or group of processes. You create a cgroup from the command line, ...


1

Assuming you are using Windows you can define the CPU settings under Power Options in the Control Panel Control Panel\All Control Panel Items\Power Options Select the plan you require and "Edit Plan Settings" then select "Change advanced power settings" (I would suggest you set up a separate plan for each scenario you plan to use to make it easy to switch ...


1

Selenium / Webdriver creates a new session/profile and starts a new clean browser for each test run. This means each Selenium session runs in a clean browser and any logins on other browsers windows are not re-used or valid. The reason for this is to test in isolation and prevent unexpected behavior of cookies, etcs. What you are trying to-do is also a bit ...


1

Your script is using a different browser session. Have the script log in using your username and password on the log in page. If you have a pre-existing account then navigate to a log in page, input the username and password, then click the login button. If you always explicitly log in, then you do not have to worry about your credentials expiring or ...


1

Well the session of a web driver instance is over once that particular instance is closed. Thus you can't access the session of the previous instance in a new one. However you can still achieve the session by storing the session value in a variable and then adding the session in the new instance. Look at the below mentioned code for better understanding: ...


1

I've been looking into this quite a lot over the past few days. By far the simplest way to solve this is to create a driver property, rather than a variable and add a wait to the get. private IWebDriver _driver; public IWebDriver driver { get{ Thread.Sleep(500); return _driver; } set { _driver = value; }...


1

The easiest way to do that in selenium webDriver is to extend your preferred WebDriver (e.g. FirefoxDriver) and override the execute methods. Write a Thread.sleep(yourWaitTime) in every execute method before return. Voila there is your speed reduce: @Override protected Response execute(String driverCommand, Map<String, ?> parameters) { try { ...


1

I've handled this before by killing the process with driver.quit(); and then re-initializing the driver and getting the URL. That will definitely kill the session, because it's running in a new JVM. Since it's the same test, you can still pass strings and integers to the new driver. Simplified Example: driver.quit(); driver = new firefoxdriver(); driver....


1

Some tools allow for defining before scenario, after scenario, before step, after step - hooks, which are called as a setup or teardown for a scenario or even for a separate step in it. If you do have such hooks, then add a delay into an "after step" hook and you'll be fine.


1

You could put a sleep after every instruction - or around the instructions you are interested in.


1

I suggest to run Fiddler or some other HTTP debugging proxy on the machine where your test is executed to check what is actually sent as part of a request. It may be that you use some outdated cookie value that results in "Session timeout". If it is indeed a problem with cookie, you can delete all cookies when you instantiate your webdriver:webdriver.manage()...


Only top voted, non community-wiki answers of a minimum length are eligible