Hot answers tagged

7

List cheeses = driver.findElements(By.className("cheese")); findElements() does not wait, but returns list of elements (located by locator). List is empty if nothing is found. http://docs.seleniumhq.org/docs/03_webdriver.jsp Also, Selenium elders very strongly advise to use only explicit waits (no implicit). And especially warn about mixing implicit and ...


6

No. Do not just split your pageObject into pageObject2, 3, 4, etc. This goes for all programming - split your classes logically by function, not arbitrarily! Your page object should be the source of truth for that specific page. When you start trying to interact with your page, does it really make sense that you should search between MyForm.java and ...


6

For writing Selenium tests itself, none. Selenium does not use SQL. Now if the application under test uses SQL, maybe you need a bit of knowledge to setup test data for your tests. For basic SQL knowledge have a look at the free SQL course at Codecademy. This should probably be enough.


4

Yes and you're definitely ahead of the crowd already with the plan you've laid out. Additional considerations: In addition to using a Page Object Model, consider a central place for hard coded values (simple methods that return a string in some cases). So the identifiers for the css locator for last_name are in one place (along with other css element ...


3

I think that you should create a page object class for each page of the site. If you have a single page site, you can create page widgets instead of page objects. The page widgets will correspond to components of the web page (example: footer, header, etc). When the number of your page object classes increases, you should create a base class that all page ...


3

This error means that you have forgotten to include a dependency in your project. It's been suggested on stackoverflow that the dependency you forgot might well be selenium-server-standalone-version.jar. Does adding that jar to your project help?


3

Some good Selenium tutorial for beginner/Intermediate/Advance are given below : 1 - ToolsQA 2 - Guru99


3

Short answer to your question: Unfortunately, Selenium do not provide any built-in function for minimizing the browser window, there is only function for maximizing the window. But there are some work around for doing this. You want window to be out of sight, then you need to use this code. by using it browser window will be out of your sight and you will ...


3

With JavaScript you can check if a DOM element is in the viewport, see this question for example code: http://stackoverflow.com/questions/123999/how-to-tell-if-a-dom-element-is-visible-in-the-current-viewport Now if we add this isElementInViewport() JavaScript function to our application under test we can call it from Selenium with the JavaScriptExecutor ...


3

As the other answer already said, the preferred order is this: ID Locator NAME Locator CSS Locator XPATH Locator However, the reason why is simple: an ID is supposed to be unique, so once you have a certain element with a specific identifier, this is unlikely to change. Also, no matter where the element is moved to on a page, the ID stays the same. ...


2

Please use below xml file and from command prompt go to project location and run as "ant generateReport" (Should have ANT). Let me know if you have any questions. .xml file: <project name="TestAutomation" basedir="."> <property name="LIB" value="${basedir}/lib" /> <property name="BIN" value="${basedir}/bin" /> <path ...


2

Instead of downloading and using your own Selenium jars I would use Maven. Maven is used as a build tool and will download any dependencies you might need, like the latest version of Selenium. Steps: Download & Install Netbeans with JDK at http://www.oracle.com/technetwork/java/javase/downloads/index.html (Also install JUnit with the installer) ...


2

It is a good programming practice to type the variable to be the the least-specific subclass that you actually care about. That way, your code is more reusable. In your case, if you actually need to call methods on FirefoxDriver that aren't defined on Webdriver, you should type Some_Variable to be FirefoxDriver. If you don't need to do anything ...


2

If you are testing for a specific image at a specific resolution then you could either compare the image with the reference image or quicker calculate the MD5 of the image and compare it with the expected. Be sure and wait for the page to be loaded, including images, before validation.


2

I really like the answer from the link Philip Beadle posted in a comment: It's a bad idea to test the core browser's behaviour as it's not your logic, i.e. you should not need to test that arrow keys work with options since that's something your browser implements. And some Protractor (JavaScript) examples how to handle the drop from the same ...


2

Setting up Selenium tests to run on Safari browser is a fairly complex process. You need to install Safari Extensions Developer Certificate in your machine and also install selenium webdriver as an extension in Safari Browser. Also there are some stability issues with Safari browser automation & Selenium combination on Mac 10.9 OS and below. The ...


2

The syntax is cumbersome, but there are a couple things you can do. If you don't care about the message returned by the first keyword, you can use Run keyword and return status. This is perhaps the easiest solution, since the keyword will return either True or False. ${status}= Run keyword and return status ... Page should contain element ...


2

You will find the answer here: http://robotframework.org/Selenium2Library/doc/Selenium2Library.html For reference, in this case I would use the keyword "Get Element Attribute" and compare it against the expected result.


2

You can use the Selenium2Library Get Element Attribute keyword to get the style attribute: | | ${style}= | Get element attribute | id=check_style@style You can then either use a regular expression to find the background color attribute or do some additional parsing. The latter would be easier to do in python than with robot keywords. For example, if you ...


2

Webdriver is faster, as compared to RC Webdriver mimics much more closer to real-life interaction; as compared to RC WebDriver supports more languages WebDriver is more actively followed/supported now; RC is past details: http://www.guru99.com/introduction-webdriver-comparison-selenium-rc.html


2

Ask your developers to add a name (which does not need to be unique) to relevant elements. find_elements (Java may have different spelling) returns a LIST of elements. If you cannot have name, you can find by CSS class. Xpath is locator of last hope, too brittle and too slow.


2

Try using //li[@class='moreGenres']/span as an xpath For css, what you have - .moreGenres>span does work - so see if maybe you have that li in more than one place perhaps? or maybe make it a bit more specific such as li.moreGenres>span or ul>li.moreGenres>span or (better) ul.this_list>li.moreGenres>span It might also be ...


2

This is my first try to setup Behat Magetest for Magento on my MacOS - my tests run quite well and I want to share my experience. First of all you should download MAMP Pro and Magento, if you did not do it already. It works without MAMP too - but that is how I did it - so feel free to work without MAMP. My final tests are based on the sample data provided ...


2

If you are using Eclipse IDE, it provides an option to Export as JAR/Runnable JAR. Please follow below steps: From the menu bar's File menu, select Export. Expand the Java node and select Runnable JAR file. Click Next. Select a 'Java Application' launch configuration to use to create a runnable JAR. In the Export destination field, either type or click ...


2

This shows how. "TestNG is used to enable parallel execution on runner level"


2

Use contains() or starts-with() function in xpah : Solution : With contains : //div[contains(@id,'post-body')]/div[1]/form[1]/input[1] With starts-with : //div[starts-with(@id,'post-body')]/div[1]/form[1]/input[1] Let me know If any query.


2

Selenium is a software library to locate elements on web page and interact with them. To deal with images, you need to use different library. Selenium can provide screenshots (images) but you need to use something else to work with such images. As a programmer, you need to master more than a single library, and learn to use right tool for the job.


2

I haven't tried it but there's a Chrome Extension called Selenium Page Object Generator that looks like it automates PO creation, and it supports C#. SWD Page Recorder also automates PO creation, and supports C#.


1

Here is what Google translated me when I searched the meaning of the word Framework an essential supporting structure of a building, vehicle, or object. a basic structure underlying a system, concept, or text. This is precisely what Test Automation Frameworks are all about in Software Testing also. I assume you know what automation means and so ...


1

I liked the "Selenium Testing Tools Cookbook". You should try it. As per your question: When people use a proven structure of handling (maintenance of script, running test) automation test scripts, which is suitable as per their requirement that’s an automation framework. Anyone can create his or her own framework as well which might be customized as per ...



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