Hot answers tagged

11

Do you think that time is the problem here? If so try to increase the time you are providing in Thread.sleep(); and see it that works out for you. If its not the time, then did you try to find out what the problem is? Are you getting any error?


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


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


4

JUnit 4 and TestNG are both very popular unit test framework in Java. However, TestNG's goal is much wider, which includes not only unit testing, but also support of integration and acceptance testing, etc. Which one is better or more suitable depends on use contexts and requirements. Annotations: In JUnit, the @BeforeClass and @AfterClass methods have to ...


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

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


3

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


3

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.


3

At this situation We have lots of options- Option 1 : Look for any other attribute which Is not changing every time In that div node like name, class etc. So If this div node has class attribute then we can write xpath as bellow. //div[@class='post-body entry-content']/div[1]/form[1]/input[1] Option 2 : We can use absolute xpath(full xpath) where you ...


3

Launching Safari browser is very easy, just you have to add safariDriver jar in your Windows Safari browser. Check after installation whether this icon is displayed or not? If Yes then it will work. Steps- Requirements: Safari Browser installed Selenium WebDriver Now we have to install SafariDriver extension with below steps. Manually install the latest ...


3

Major difference in TestNG and JUnit test frameworks is their scope. Junit is a unit testing framework while TestNG addresses testing at a higher level. and my recommendation is TestNG(Next Generation) Framework. Find the some references to get details about both of them- http://www.slideshare.net/ssuser220b38/junit-and-testng http://software-testing-...


3

You will get this exception when WebDriver Is not able to locate element on the page of software web application using whatever locator you have used In your test. To resolved this Issue, I will check bellow given things. First of all I will check that I have placed Implicit wait code In my test or not. If you have not placed Implicit timeout In your test ...


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

driver.ExecuteScript(string.Format("document.getElementById('cred-password-inputtext').value='{0}';",password)); This solution has resolved my problem.


2

https://github.com/2gis/Winium.Desktop (the following text is just to get through the 30 characters limit) Winium.Desktop is an open source test automation tool for automated testing of Windows application based on WinForms and WPF platforms. Winium.Desktop.Driver implements Selenium Remote WebDriver and listens for JsonWireProtocol commands.


2

There is another tool to record page object model. below is the link: http://seleniumrecorder.blogspot.com/


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


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

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


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

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

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.



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