Tag Info

Hot answers tagged

19

I think using selenium.webdriver.support.ui.Select is the cleanest way: from selenium import webdriver from selenium.webdriver.support.ui import Select b = webdriver.Firefox() # navigate to the page select = Select(b.find_element_by_id(....)) print select.options print [o.text for o in select.options] # these are string-s ...


16

While it's not updated as regularly as it once was, Grig Gheorgiu's Python Testing Tools Taxonomy is considered by Pythonistas to be an excellent reference point for tools. It covers the following kinds of testing tools: Unit Testing Tools Mock Testing Tools Fuzz Testing Tools Web Testing Tools Acceptance/Business Logic Testing Tools GUI Testing Tools ...


13

The easiest way that I have found was to do something along the lines of: el = driver.find_element_by_id('id_of_select') for option in el.find_elements_by_tag_name('option'): if option.text == 'The Options I Am Looking For': option.click() # select() in earlier versions of webdriver This may have some runtime issues if there are a large number ...


10

All the learning starts from step1. You have learned based on your own interest. I had a lot of support from this community and stackoverflow when i started writing automated tools. I can share my experience. 5 Rules for beginners getting into test automation Rule#1 - Do not worry about design, error handling when you start writing your automation suite. ...


7

Burp Suite would be worth checking out if you're fuzz testing web applications. As the name implies, it's actually a suite of different web security testing tools - I used it for the first time on Monday in a pen testing workshop and it seems like a tremendously useful tool. Burp Intruder is the tool used for fuzzing attacks - and here's a video tutorial ...


7

I'm going with my favorite response here: it depends. Sometimes the decision is made because that's the language the tool supports. Sometimes the language is a flavor of the language used by the development team - this often happens where there's an expectation that the development team will be writing at least some of the test automation code. Sometimes ...


7

Yes, you're on the right path (though I have a caveat or two). More generally than "raise the right exception": The tactic is to make sure that no matter how SVN responds to your app's commands, your app responds as you wish. For me, the biggest challenges when mocking third-party code is to characterize: All the ways my code uses the third-party code ...


5

Do you need Selenium for this task? If you have an existing suite of Selenium tests, you can run them against the new site to verify the functionality is working, but in general Selenium is not the best tool for validating look and feel, or massive amounts of content. There are several link checker tools that will crawl all of the links and download all ...


5

checkboxes = self.browser.find_elements_by_xpath("//input[@name='arr[]']") for checkbox in checkboxes: if not checkbox.isSelected(): checkbox.click() (Previous answer): I am not yet familiar with the python syntax, but this is what you can do: Return all elements with the given xpath: ...


5

My experience with automation is that it's invaluable for regression, particularly the kinds of regression that are tedious and painstaking to perform. A login script is usually a utility that happens as part of a larger script suite - which must, as Siva said, be object-oriented and data-driven if you don't want to create yourself a maintenance nightmare. ...


5

As @Niels van Reijmersdal mentioned, it makes sense to use the language in which you have local experts available. But you don't have to use the same language - use the language in which your team will be more productive. Python and Ruby are almost identical in expression power. I would argue that Python is more readable, which is significant advantage when ...


4

Remove the uncovered line from your .py file and use python -c "import foo; foo.main(args);" You can wrap that in an alias or a bash function.


4

I had only one experience of automation testing for Qt apps on Linux. The tool I used is Squish, and it supports Java, Web and Mobile testing as well. The test scripts are written in python. Just FYI. It's a commercial product, you need to buy the license.


4

I am the author. Actually this is a patch-like binding. You should know what I said in step 2. You need to download the source code of official Python bindings for Selenium and then copy my patch to the source files and install the patch source code, as mentioned in step 3 and 4.


3

I think what you are looking for is the SSH plugin for Hudson: http://wiki.hudson-ci.org/display/HUDSON/SSH+plugin It let you run a shellscript before and/or after your build. That's the best fit, in my opinion. But you can execute a shellscript on the Hudson server using the Post Build task plugin: ...


3

As it happens, that isn't (as far as I can tell) the official documentation, which is here: http://selenium.googlecode.com/svn/trunk/docs/api/py/index.html (And which does have the full API reference.)


3

Nose supports parametric/generative tests, http://readthedocs.org/docs/nose/en/latest/writing_tests.html#test-generators For example: def checker(combination): # do something to verify the combination assert 'A' in combination def test_generator(): options = ['A', 'B', 'C'] for o in options: yield checker, o for p in ...


3

There are times when using the Page Object Pattern makes a lot of sense and times where it doesn't make as much sense. If you have a web application where it is basically one single dynamic page then it makes less sense, however you can still use "page" objects that are really more like "section" objects for common pieces, for example if you have a Left ...


3

I haven't used the Python bindings, but as far as I know they should be equivalent to the Java ones. If I were you I would try to find the Python equivalents of findElements() and isDisplayed() that are available in the Java bindings. For example, I would do something similar to this: // ... myElementList = driver.findElements(By.Id("fancybox-close")) if ...


3

Mechanize is quite powerful request-based tool to test web apps. http://wwwsearch.sourceforge.net/mechanize/


3

You need to install the selenium bindings for Python. Try this: sudo pip install selenium


3

The simplest option is to just mark the line as ignored by your coverage tests. You know more than coverage.py does, you can just excuse the line from the measurements: if __name__ == '__main__': # pragma: no cover return main(sys.argv) You can also use some tricks with coverage.py to get it to measure code in launched subprocesses. This sounds ...


3

It seems you may not be accustomed to piping. No worries, it was new to everyone at some point. By using the shell to call your tests, you're mostly there already. A key thing here is that anything that get's written to your terminal can be "piped" into a file that you name. If you are seeing those results in your terminal, then you can route them to a ...


3

I suspect Powershell's design center is tight integration with Windows services. Python is probably less tightly integrated with Windows, but may have a more substantial set of libraries, e.g. NumPy and SciPy for manipulating numeric data. An indication of its popularity is that a lot of college programming classes taught with Python now; I don't know how ...


3

Welcome to the club, Praveen; your problem is a rite of passage for Selenium users. Instead of trying to automate the file dialog, you may have better luck issuing the same HTTP request that your file upload form would have issued. Issuing a POST request for a file upload is a little bit harder than a GET request because of the encoding issues, but I ...


2

If you want it to be portable, you need to have the firefox profile included in your build and copied to the working directory. You should be able to reference it from there easily. This will work even if you copy all of your tests to a different machine and execute them there.


2

try using nose, it should run all unit tests of a project with one single command


2

I had a similar problem and was able to resolve it by finding the elements by xpath: from selenium import webdriver b = webdriver.Firefox() #...some commands here b.find_element_by_xpath("//select/option[@value='The Options I am Looking for']").click()


2

I haven't used it myself (although I plan to on my side-project when I get it to private alpha stage) but I think Hexawise would be able to do some of this. You can tweak the phasing parameters (2 pairwise, 3 pairwise, I think it goes up to 6) and it will generate values in certain ranges. This should be pretty close to what you're looking to do. You can ...


2

I wonder if it would be faster to use Xpaths to search specifically for cells in the row of interest, rather than fetching all rows and then manipulating the one row you are interested in. I am not fluent in Python, so I will illustrate my suggestion in pseudo-code: for i in 1..51 condition_xpath = "//table/tr[" + i + "]/td[1]" column1 = ...



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