Tag Info

Hot answers tagged

14

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 ...


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

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 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

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

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

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.


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) ...


7

Apache JMeter is really cheap, and by really cheap, I mean free. It should be able to handle the find operations you are looking for. The download link is: http://jmeter.apache.org/download_jmeter.cgi


7

Look at the Wait commands rather than sleep - a search on this site or Google will give you lots of examples


6

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 tests ...


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

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 ...


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

Well, in fact I am using xpath. The best way is to put an static -of course unique- id to the elements you want to refer.


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

I had the same problem and actually dislike this "feature" in Selenium. In my C# abstraction layer I replaced getText with this: return ((IJavaScriptExecutor)webDriverInstance).ExecuteScript("return arguments[0].innerHTML", elementInstance).ToString();


6

Here's a solution. Set Firefox's preferences to save automatically, and not have the downloads window popup. Then you just grab the file, and it'll download. So, something like this: FirefoxProfile fxProfile = new FirefoxProfile(); fxProfile.setPreference("browser.download.folderList",2); ...


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

It is not necessary to create a new instance of the driver object. You can use JavaScript to open a new window which is a lot faster. To open the window: IJavaScriptExecutor jscript = driver as IJavaScriptExecutor; jscript.ExecuteScript("window.open()"); Then to switch windows, use the window handles: List<string> handles = ...


5

One option is HTMLUnit which is headless but has its own proprietry JavaScript rendering engine so it is possible that it will behave differently to existing browsers (If you do use HTMLUnit don't forget to enable JavaScript when you instantiate it). The second option is to use XVFB, this will run the tests in a virtual frame buffer environemt. This has ...


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

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 ...


5

Try to click the "Continue to this website (not recommended)." link in the following way (works for me on EI7, IE8): webDriver.navigate().to("javascript:document.getElementById('overridelink').click()");


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 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 ...



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