Tag Info

Hot answers tagged

13

I find the Page Object pattern very useful, and use a modified PageFactory (parameterized for custom timeouts). I also use WidgetObjects (basically, PageObjects with a parent reference via constructor) to represent common themes across pages. I don't think URL association is necessary on all pages, so I keep it out of my base class. URL params? I keep ...


11

Link to my blog where I discuss this in more detail. First of all why do you want to download the file? Are you going to do anything with it? The majority of poeple who want to download files just do it so that they can show an automation framework downloading files because it makes somebody non-technical ooo and ahh. You can check the header response ...


10

You can capture network traffic using a proxy, such as the BrowserMob Proxy (http://proxy.browsermob.com) To configure the use of the proxy with a webdriver instance, set the CapabilityName.PROXY value to a org.openqa.selenium.Proxy instance: Proxy proxy = new Proxy(); // The URL here is the URL that the browsermob proxy is using ...


9

The class you are looking for is the WebDriverWait class that you can find here (C#): http://code.google.com/p/selenium/source/browse/trunk/dotnet/src/WebDriver.Support/UI/WebDriverWait.cs I created an extension method to make it easier to use that looks something like this: public static class BrowserExtensions { public static T ...


9

The default WebDriver setting for timeouts is never. WebDriver will sit there forever waiting for the page to load. The following timeouts are available: /** * An interface for managing timeout behavior for WebDriver instances. */ interface Timeouts { /** * Specifies the amount of time the driver should wait when searching for an ...


9

I suspect this is not a TestNG issue. I would start by trying to produce a minimal set of tests that, when run together, cause failures. After that, I would explore these possibilities: Inter-test interaction changes test-application interaction: It is possible that interaction between your tests changes how your test interactions with your application. ...


9

Strictly speaking you don't need to know how databases work to work with any automation tool. But without an understanding of databases and the ability to query them, you block off a large source of extra information you can use for validation. Some examples: Your application takes a person's name and contact details and stores them in three tables (for ...


8

SeleneseTestCase is deprecated and shouldn't be used any more, use extends SeleneseTestBase instead.


8

If you can, try & promote the idea of test first development (aka TDD, BDD, ATDD, Specification By Example) with Continuous Integration (frequent commits to a pipeline such as Hudson or GO from Thoughtworks which continuously runs the automated checks to see if any of them have broken after a recent commit) Before Developers write the code, they write ...


8

These days, I'd say Selenium RC is not worth learning unless you have a specific need for it--for example, to work with legacy test code that uses it. I don't think it will give you a significantly better appreciation of the Selenium architecture. You can get that by exploring the Selenium code base if you have an interest. If you the know WebDriver API ...


7

A possibly more generic solution to this problem is to wait for the jquery to complete. You can do this with a function like this: public void WaitForAjax() { while (true) // Handle timeout somewhere { var ajaxIsComplete = (bool)(driver as IJavaScriptExecutor).ExecuteScript("return jQuery.active == 0"); if (ajaxIsComplete) ...


6

Don't forget the not only performance is better with CSS locators, it's the compatibility too that matters. We are testing on a multy browser environment in which we use: IE, SAFARI, FIREFOX, CHROME. On IE the xpath almost never works OR it is SO slow that it can't be managed. So we use CSS where ever we can. Unfortunately IE does not support many CSS ...


6

As far as I know there is no easy way to make Selenium download files because browsers use native dialogs for it which cannot be controlled by JavaScript, so you need some "hack". Check this, hope it helps.


6

I assume that you are not using stand-alone jar of selenium. Can you download Selenium Server Standalone jar and use it in eclipse. This is the only jar you need from selenium-java as it encompasses all required class files. You can remove other Selenium related jars from your eclipse.


6

Blobinator, welcome to SQA. For the purposes of your question, it may help to think of a UI test as two overlapping activities: interacting (e.g. clicking/typing) and verifying (confirming that the site behaves correctly). Interacting and verifying overlap because it may not be possible to interact in the way you intended unless the site behaves correctly. ...


6

Selenium is a tool that remote-controls a browser. You can use it to simulate a user interacting with a web site. JUnit is a framework for writing Java unit tests. It takes some of the grunt work out of organizing tests and generating reports. You can express each test as a method on a class; typically, you have multiple tests per class. JUnit will run ...


5

I wouldn't use the WebDriverBackedSelenium class at all. It's designed to be a bridge class to help people migrate there tests using the Selenium RC API (on which very little work is being done) to the Selenium WebDriver API. Rather, I'd use the techniques the WebDriverBackedSelenium class uses in my own tests. In the case of asserting that an element ...


5

While I'm not certain if these mechanisms will specifically work with the Telerik controls (I know it works with jQuery), there are a couple of ways to do this. You can use IRenderedWebElement.DragAndDropOn(), but this method is deprecated. The newer way, which isn't available in a released binary form yet, but is checked into the source tree and will be ...


5

I am actually not entirely sure you can switch to a window not spawned by the driver. I think the people working on the selenium 2 project have worked a little bit on switching to a window spawned by a different driver. When you do: driver.getWindowHandles() All you get are the windows spawned by the driver object it is called on.


5

There's a couple of solutions depending on how your particular company is set up. The easiest is if the machine that you're running the tests from is on the same domain as the server where the site is hosted. Have the team that manages the server to create a self-signed certificate and have the cert added to your machine. If the self-signed route doesn't ...


5

Quite simply No! WebDriver was a project in its own right before it merged with Selenium so looking at the Selenium RC codebase and API is not going to give you any insight as to why certain decisions were made inside WebDriver. Selenium RC is currently deprecated, so if you do start learning it you are learning something that is no longer supported and ...


4

I appreciate the value of being able to run tests on a machine that does not have a desktop. However, I have never been successful at getting a test that works with a real browser to also work with HtmlUnitDriver. I would be reluctant to draw any conclusions about the quality of a web application based on the results of running an HtmlUnitDriver-based ...


4

No there is no native solution at the moment. If you use webDriverBackedSelenium you can try to utilise the captureNetworkTraffic functionality, however there were issues with it last time I heard it talked about (See here for more info - https://groups.google.com/d/topic/selenium-users/fMSHeH9ZVqU/discussion). It's also worth noting that ...


4

This sounds similar to a problem I dealt with recently using watir-webdriver (which, if you're using webdriver will be similar). In my case I was able to resolve/ workaround by sending a click at the element (to select it) before using sendKeys. So I suggest you could try sending a click to the element before using sendKeys. :)


4

I suspect your browser asks you to accept xyz.com's certificate because the certificate is self-signed. There are ways to work around the problem, but they are browser-specific, and you did not mention which browser you used. Some options for Firefox include: Configuring the browser to accept all certificates. I do not recommend doing this unless your ...


4

This is possible with Selenium 2 and WebDriver. I'm not sure if it is with different versions. In Selenium 2 with WebDriver you can call webDriver = new FirefoxDriver(); which spawns a browser, and that browser will stay open for the duration of your testing, or you can choose to close it with webDriver.Quit();. I like to close my browser window between ...


4

We sometimes have problems like this. I have found the easiest way to solve this is to use a wait function. I imagine that when the page is loaded the button is hidden and there is javascript to make it visible. Often times the driver will run faster than the javascript. EDIT: elem = self.web.find_element_by_id('tos_agree') driver = self.web elem_visible ...


4

Phrase "sometimes works sometimes not" often means that Selenium tried to make an action when that action was unavailable at that time (the easiest method to check is to make long pauses before each action). In this case I recommend for you to make your own custom method WaitWhileProcessing which commands WebDriver to wait until full page is rendered. How ...


4

I agree that your tests will require ongoing maintenance (as does most test automation). There are tactics for organizing your Selenium tests so that maintenance is easier, but they depend upon how the user interface is written, whether the developers help maintain the tests, and the manner in which the user interface changes. In fact, the quicker the user ...


4

I'd recommend seriously looking at building a framework that has the absolute minimum of repeated script code - this has the advantage of minimising update work. Similarly, I'd consider data-driven scripts with an object-oriented framwork where you're building your transaction objects to harness the application's features. That way, as the application ...



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