How to handle a popup in selenium webdriver?

Software Testing: What programming language has the best WebDriver/Selenium bindings?

  • Do some programming languages cover the shortfalls of others when it comes to browser automation?  What language would an advanced beginner commit to learning if they really wanted the most bang for their buck when it comes to Webdriver testing?

  • Answer:

    If you don't like Java and favoured Python, give Splinter [1] a shot. I really enjoyed using it. It makes the verbose, Java-ish Selenium API more Pythonic and a pleasure to work with. [1] http://splinter.cobrateam.info

Ryan Gao at Quora Visit the source

Was this solution helpful to you?

Other answers

My bet is Java. Since Selenium itself is developed in Java. Anyway all the bindings are pretty similar. AFAIK only the capitalization of class names may be different. "Drivers" are same for each language, so you shouldn't face any functionality issues depending on bindings. I know that people are successfully testing in other languages like C#, Ruby or Python. So it's mainly up to you. You should choose the language itself, and not the bindings. If you already know some of these languages - use it for Selenium. If not - I think Python is the easiest of them to learn, but you will find less examples on Python+Selenium (comparing to Java+Selenium samples). So if you are not willing to investigate something - move to the next point. Java is the most common case. If you are working in a company I think it's your best choice. Since your code will be more maintainable in future (if you decide to leave).

Artyom Silivonchik

Problem with using java for Webdriver is that you often end up writing  way too much code. In my opinion, unless you are doing some sophisticated theory proving, your tests should never be more complex or harder to maintain than the application you are testing. Personally, I am using scala and java, but I am playing around with Ruby/JRuby  and seriously considering switching to it. Dynamically modifying your tests at run time is fun :) P.S. Just saw this http://cran.fhcrc.org/web/packages/RSelenium/index.html . R with Selenium would certainly be an interesting option as R is incredible for reporting and analysis

Azzie Elbab

Java would always be the best and more complete than other bindings. From speed of test development perspective, though, I and my team use Python programming and we find the bindings pretty decent and sufficient for automating complex web apps of today.

Rahul Verma

Java is my choice as well. Yes, some people say that Ruby and Python are easier to learn and suggest to learn Java later. But if you should learn it anyways, why not start with it? Java is a great first choice (even if a bit more difficult) for the following reasons: while learning it, you will have lots of questions; most of developers know Java and C# (which is based on Java); it should not be very difficult to find a Java developer to ask for help learning Java is useful for learning other non-functional testing types like performance testing (JMETER allows using Java for bean shell scripts) and API testing (SOAP UI allows using Groovy, a flavor of Java, for assertions) java seems to be still the most popular language on the job market; see trends on this link for Java, C#, Ruby, Python; java seems to have the highest number of jobs for the moment:@http://www.indeed.com/jobtrends?q=java&l= See more on this topic on my blog: @http://test-able.blogspot.ca/2015/07/what-programming-language-to-learn-for-test-automation.html Thanks. Alex

Alex Siminiuc

JAVA has the best compatibility with Selenium Webdriver.Examples: 1. Creating New Instance Of Firefox Driver WebDriver driver = new FirefoxDriver(); 2. Command To Open URL In Browser driver.get("Only Testing: New Test"); 3. Clicking on any element or button of webpage driver.findElement(http://By.id("submitButton")).click(); 4. Store text of targeted element in variable String dropdown = driver.findElement(By.tagName("select")).getText(); 5. Typing text in text box or text area. driver.findElement(http://By.name("fname")).sendKeys("My First Name"); 6. Applying Implicit wait in webdriver driver.manage().timeouts().implicitlyWait(15, TimeUnit.SECONDS); 7. Applying Explicit wait in webdriver with WebDriver canned conditions. WebDriverWait wait = new WebDriverWait(driver, 15);wait.until(ExpectedConditions.textToBePresentInElementLocated(By.xpath("//div[@id='timeLeft']"), "Time left: 7 seconds")); 8. Get page title in selenium webdriver driver.getTitle(); 9. Get Current Page URL In Selenium WebDriver driver.getCurrentUrl(); 10. Get domain name using java script executor JavascriptExecutor javascript = (JavascriptExecutor) driver;String CurrentURLUsingJS=(String)javascript.executeScript("return document.domain"); 11. Generate alert using webdriver's java script executor interface JavascriptExecutor javascript = (JavascriptExecutor) driver;javascript.executeScript("alert('Test Case Execution Is started Now..');"); 12. Selecting or Deselecting value from drop down in selenium webdriver. Select By Visible Text Select mydrpdwn = new Select(driver.findElement(http://By.id("Carlist")));mydrpdwn.selectByVisibleText("Audi"); It will select value from drop down list using visible text value = "Audi". Select By Value Select listbox = new Select(driver.findElement(By.xpath("//select[@name='FromLB']")));listbox.selectByValue("Italy"); It will select value by value = "Italy". Select By Index Select listbox = new Select(driver.findElement(By.xpath("//select[@name='FromLB']")));listbox.selectByIndex(0); Reference Books:

Naru BITS Pilani

Selenium webdriver supports Java, C#, Ruby, Python, Perl etc.  If you ask me, Java is always preferable to me as i am comfortable with java, it reduces my learning curve. I have a feel that you get good support & samples code also if you are using JAVA compare to C#.  You can use any other language option too, whichever you are comfortable with. Even you can try scripting language too. As my fellow member mentioned in his answer. If not - I think Python is the easiest of them to learn, but you will find less examples on Python+Selenium (comparing to Java+Selenium samples). So if you are not willing to investigate something - move to the next point. Java is the most common case. If you are working in a company I think it's your best choice. Since your code will be more maintainable in future (if you decide to leave).

Richa Agrawal

Just Added Q & A:

Find solution

For every problem there is a solution! Proved by Solucija.

  • Got an issue and looking for advice?

  • Ask Solucija to search every corner of the Web for help.

  • Get workable solutions and helpful tips in a moment.

Just ask Solucija about an issue you face and immediately get a list of ready solutions, answers and tips from other Internet users. We always provide the most suitable and complete answer to your question at the top, along with a few good alternatives below.