We changed our privacy policy. Read more.

Hot answers tagged

39

One of the biggest mistakes in my career was to pick a different programming language for the test automation than the development team uses. You won't get help from the development team when you have a programming issue Developers will probably not run, nor maintain tests as they change the application, you will be maintaining and analysing test results (e....


23

Use findElements instead of findElement. findElements will return an empty list if no matching elements are found instead of an exception. To check that an element is present, you could try this Boolean isPresent = driver.findElements(By.yourLocator).size() > 0 This will return true if at least one element is found and false if it does not exist. ...


20

Implicit Wait: An implicit wait is to tell WebDriver to poll the DOM for a certain amount of time when trying to find an element or elements if they are not immediately available. The default setting is 0. Once set, the implicit wait is set for the life of the WebDriver object instance. WebDriver driver = new FirefoxDriver(); driver.manage().timeouts()....


19

Writing unit tests is not difficult - as the saying goes, it is matter of simple programming :-) So if you are competent programmer, and are willing to learn necessary skills and patterns, you can do it as QA engineer. But IMHO (and best practices say that) developers are much better suited to write unit test - because unit tests use internal calls to ...


14

How to get started with Selenium: A Brief Overview So you want to automate browser-driven tests, and you're not sure where to get started. You've heard of this "Selenium" thing, and you think it's what you want, but you can't be sure. Fret not! Here's a quick rundown of what you're looking at and how to get going. This is mostly adapted from two ...


14

You can choose any language irrespective of which language is used in development. But it would be better if you go with same programming language which is used in the development, in your case it would be C#/.NET for below reasons: You can leverage existing libraries used by your team. Developers can help you out, As you said you will the only person doing ...


12

The Wikia project has their Selenium tests online, looks like a little bit more then just examples. It contains a Page object factory and hundreds of tests and looks like it is pretty active with multiple commits per day. The test cases: https://github.com/Wikia/selenium-tests/tree/master/src/test/java/com/wikia/webdriver/testcases I found this when I ...


12

See the answer to "ChromeDriver user preferences ignored" cOpt.AddUserProfilePreference("credentials_enable_service", false); cOpt.AddUserProfilePreference("profile.password_manager_enabled", false);


11

To broadly address your question, just pick some test cases with simple interactions that aren't very dynamic and automate those. Trial, error, and practice will get you there. Is Java mostly used for Selenium tests? Do you recommend it over C#? According to StackOverflow, there are more Selenium tagged questions in Java than any other language (as of ...


11

Check below are the various methods to scroll your web page up & down: Scroll Down: import org.openqa.selenium.JavascriptExecutor; WebDriver driver = new FirefoxDriver(); JavascriptExecutor jse = (JavascriptExecutor)driver; jse.executeScript("scroll(0, 250)"); //y value '250' can be altered Scroll up: JavascriptExecutor jse = (JavascriptExecutor)...


10

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


10

Yes, use soft assertions org.testng.asserts.SoftAssert. Soft assertions are assertions that do not terminate the test when they fail but their results are included in the test execution report. More articles on that topic: https://stackoverflow.com/questions/19091526/how-soft-assertions-work https://rameshbaskar.wordpress.com/2013/09/11/soft-assertions-...


10

See, you can learn Selenium with any language, whether it is C#, Java, Ruby, Python etc. It doesn't matter whether the application you are going to test has been developed in the same language that you would use to write your test scripts, you can test an application developed using C# in Selenium with test scripts written in Java. In addition to that, you ...


10

Answering the comments above, Well I had Java and Jmeter installed correctly with ClassPath and everything. I also tried running Command Prompt as Administrator but got the same result. There was no problem in that. That is why the GUI version was working properly in first place. After a lot of R&D and Googling I found out that the problem was with the ...


9

The reason you are getting so many different matched is because you print it as you go through the loop. My personal suggestion, I like the KISS method, change the code to something like the following: public class Ex1 { private WebDriver d; @Test public void testUntitled() throws Exception { d = new FirefoxDriver(); d.get("http://register.rediff....


9

It's certainly possible - that's the way I and many others here became testers. As Som Ghosh says, you will need to mention in your applications for test positions that you have worked in testing as well as development. I'd suggest you include details of the kind of testing you've done and the scale of the projects that you tested. I would recommend that ...


9

I don't know whether a certification is necessary for automation testing, but you definitely require good coding skills and logic development skills for it. Its advantageous to learn Java as its open source and hence there are countless forums and communities to seek kelp. Plus many of the automation testing tools (specially open source testing tools) use ...


9

The question and the description that you have written for it are misleading. I'm assuming you want to know which certifications will help you get a start for your career in Software Testing. Well for that I don't think you need to go for any certifications. Read good blogs and article on testing. There are thousands of them available on the internet. ...


9

Certifications don't teach testing. Still if you want to go for one, well, there are several available out there. But, they don't teach you how to test, they mostly teach only a certain terminologies. Yes, learning a programming language is an added advantage for a tester, especially for someone who is looking to make a career in automation testing or ...


9

If the Java GUI application is based on Swing, AssertJ Swing is probably one of the best open source libraries. It's a fork of FEST and has several advantages: Simulation of user interaction with a GUI (e.g. drag 'n drop) Reliable GUI component lookup (by type, by name or custom search criteria) Support for all Swing components included in the JDK ...


9

The character ' is an apostrophe. The colon character is :. Selenium unfortunately only supports XPath 1.0, so this is tricky. You can do it by escaping the ' with a backslash like this: By.xpath("//span[@trans=\"'WbOrderHeader.OneCancelsAnother\"]")


9

Definetly learn C#. Why? At Selenium tests level it's basically the same thing as Java 9. With a bit of syntactic sugars. It shouldn't take you more than 2 weeks to get up to speed with C#. CI/CD and whole infrastructure is set up for dotnet. If you don't want to run this automated tests manually, you will have to either: configure whole infrastructure to ...


8

You can use WebDriverWait to synch with page load. Something like the following might help WebDriverWait wait = new WebDriverWait(driver, 15); //you can play with the time integer to wait for longer than 15 seconds.` wait.until(ExpectedConditions.titleContains("title")); //if you want to wait for a particular title to show up OR wait.until(...


8

For testing it, your doing an extremely basic test. A major advantage of automation is that you can do a lot more testing. I would set up a datasource for names, declare them valid or invalid, and have it attempt to use it. I would also have it only use one of the special characters at a time and the rest be valid (As of now your essentially testing if any ...


8

Here is a good example of how I select from a dropdown menu: public Boolean selectByText( String text ) { WebElement dropDown = driver.findElement( By.xpath( ".//dropdown/path" ) ); dropDown.click(); List<WebElement> allOptions = dropDown.findElements(By.xpath(".//option")); for ( WebElement we: allOptions) { dropDown.sendKeys(...


8

Yes, it is important to validate HTML. There are W3C standards against which you can validate it. You can use various tools like the W3C Html validator, or Web Developer addon of FireFox. There are several such paid an unpaid tools that can help you validate your HTML. It helps in page optimization and SEO.


8

Java My experience is, that the basics of Java suffice to start developing test cases with Selenium 2 / WebDriver. Myself started developing of Selenium test cases with a basic knowledge about Java. The more test cases I wrote and solutions I had to find, the more I leaned about the programming language. Unit Testing Framework (JUnit, TestNG) Write some ...


8

You may be getting the previous page source code because the getPageSource() method is called before the page arrives to the page you want. One thing I would like to suggest is before getting the pagesource of the webpage check whether you have navigated to the correct page like: public static void testLogin(WebDriver driver) { if(driver.getCurrentUrl(...


8

In Java: ChromeOptions options = new ChromeOptions(); options.addArguments("--start-maximized"); options.addArguments("--disable-web-security"); options.addArguments("--no-proxy-server"); Map<String, Object> prefs = new HashMap<String, Object>(); prefs.put("credentials_enable_service", false); prefs.put("profile.password_manager_enabled", false)...


8

HTTP is a synchronous protocol* so active polling is not an option. You need to wait until client receives response or request times out. There are two ways to constrain synchronous behaviour with timeout. One is to set a timeout for receiving a response. REST-Assured uses Apache HTTP Client for which you can set http.socket.timeout and http.connection....


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