Note that there are some explanatory texts on larger screens.

plurals
  1. PO
    text
    copied!<p>Selenium IDE is in-browser, it's then normal you can run at any step. But if your cookies have expired, you'll have to reauthent. It's not a Selenium problem, it's how websites work. In your tests, you'll always have to start from scratch if your cases involve athent process, unless you manage to get a fine control over your cookies. </p> <p>You can always make a quick http call to the website you want to connect to with <code>HTTPClient</code> for example, just to get the cookie back, then use it in webdriver with something like </p> <pre><code>driver.manage().addCookie(new Cookie("foo", "bar", "www.domain.com", "/", null)); </code></pre> <p>then go to the page you need. Notice that this solution solves the Authent problem only, and does not control the <strong><em>state</em></strong> of the tested web-application (data previously posted, etc...).</p> <p>At our company, we make an extensive use of selenium, and have a lot of tests relying on it, it's therefore a problem we know something about and we are aware of the frustation it can cause. </p> <p>We use a pretty different solution to get a productivity boost on tests. In fact, we're using a <a href="http://groovy.codehaus.org/Groovy+Shell" rel="nofollow"><code>Groovy Shell</code></a>-based solution which allows us to go back and forth while developping the tests and keep our browsers open. <code>Groovy</code> is a JVM scripting language that is really easy for a Java dev (almost all Java code is valid Groovy code) and it's really dynamic. </p> <p>So you can download groovy, run groovy shell (<code>groovysh</code> is the command), then line by line you can launch and interact with the browser xhile your written code is saved to a buffer. When you've done with your test, export the code and put it in Eclipse. It's faster than restarting every time from scratch. Magic lines for starting with selenium are </p> <pre><code>groovy.grape.Grape.grab(autoDownload: true, group : 'org.seleniumhq.selenium', module : 'selenium-firefox-driver', version : '2.37.1') import org.openqa.selenium.* import org.openqa.selenium.firefox.* driver = new FirefoxDriver() driver.get("http://my-website.com") </code></pre> <p>From this point, the browser window is always open, and you develop right in groovy (or java). It's like a selenium-ide, but in groovy, and can be integrated in your developement workflow (but there is a bit of work to do) This example works for Firefox (as you've probably guessed ;-)) but you can adapt it as you like. We have from this constructed a bunch of tools to develop our tests quickly and iteratively. We found this to be a great savior. </p>
 

Querying!

 
Guidance

SQuiL has stopped working due to an internal error.

If you are curious you may find further information in the browser console, which is accessible through the devtools (F12).

Reload