简体   繁体   中英

Selenium Webdriver with Java vs. Python

I'm wondering what the pros and cons are of using Selenium Webdriver with the python bindings versus Java. So far, it seems like going the java route has much better documentation. Other than that, it seems down to which language you prefer, but perhaps I'm missing something.

Thanks for any input!

"If you're running selenium tests against a Java application, then it makes sense to drive your tests with Java." This is untrue. It makes no difference what the web application is written in.

Personally I prefer python because it's equally as powerful as other languages, such as Java, and far less verbose making code maintenance less of a headache. However, if you choose a language, don't write it like you were programming in another language. For example if you're writing in Python, don't write like you were using Java.

You've got it spot on, there are ton load of documents for Java. All the new feature implementations are mostly explained with Java. Even stackoverflow has a pretty strong community for java + selenium.

Generally speaking, the Java selenium web driver is better documented. When I'm searching for help with a particular issue, I'm much more likely to find a Java discussion of my problem than a Python discussion.

Another thing to consider is, what language does the rest of your code base use? If you're running selenium tests against a Java application, then it makes sense to drive your tests with Java.

For me it's just a language preference. There are bindings for other languages, but I believe they communicate with Webdriver via some sort of socket interface.

It really does not matter. Even the Documentation. Selenium lib is not big at all.

Moreover, if you are good in development, you'll wrap selenium in your own code, and will never use driver.find(By.whatever(description)) . Also you'd use some standards and By.whatever will become By.xpath only.

Personally, I prefer python and the reason is that and my other tests for software use other python libs -> this way I can unite my tests.

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM