可以使用硒自动使angularjs应用程序自动化吗?如果是,为什么要使用量角器? [英] Can angularjs apps be automated with selenium? if yes, why should we use protractor?

查看:79
本文介绍了可以使用硒自动使angularjs应用程序自动化吗?如果是,为什么要使用量角器?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

我知道我们可以使用Selenium自动化AngularJs应用.但是我们有一个单独的E2E测试框架,它是AngularJs应用自动化的量角器.

I know that we can automate AngularJs apps with Selenium. But we have a separate E2E testing framework that is Protractor for AngularJs apps automation.

有人可以帮助我理解为什么我们应该使用量角器吗?为什么不硒?

Can anyone help me understand why we should use Protractor? Why not Selenium?

推荐答案

不确定我了解您的问题.我可以假设您宁愿使用Selenium吗?但是想了解您所缺少的是什么吗?

Not sure I understand your question. Am I right to assume you'd rather use Selenium - but want to understand what you're missing?

很好-Selenium提供了使Web浏览器自动化的方法-因此可用于自动化e2e测试. Selenium API具有几种主要编程语言的实现-允许您用Java,C#,python,ruby,JavaScript等编写测试.

Well - Selenium provides means to automate web browsers - and thus used for automated e2e tests. Selenium API has implementations in several major programming languages - allowing you to write your tests in Java, C#, python, ruby, JavaScript and more.

如果您已经有一个基于硒的e2e测试框架-您也可以将其用于AngularJS Web应用程序.您还可以编写必要的JavaScript脚本,这些脚本一旦使用webdriver运行即可让您完成Protractor的所有工作-但您必须自己做(只是从Protractor源代码中借用).

If you already have a selenium-based e2e testing framework in place - you can use it also for AngularJS web-apps. You can also write the necessary JavaScript scripts that, once ran using the webdriver - will let you do all that Protractor does - but you'll have to do it yourself (just borrow from Protractor source code).

为什么可行?因为Protractor基本上采用了Selenium Webdriver的JavaScript实现,并且以某种方式包装了它,从而使您在测试Angular JS Web应用程序时的生活变得更加轻松.

Why is it doable? Because Protractor basically took the JavaScript implementation of Selenium Webdriver and wrapped it in a way that makes your life a bit easier when testing Angular JS web apps.

您可以在我的这个旧帖子中看到具体的解释: http://testautomation.applitools.com/post/94994807787/protractor-vs-selenium-哪个更容易

You can see specific explanations in this old post of mine: http://testautomation.applitools.com/post/94994807787/protractor-vs-selenium-which-is-easier

我想说的是,如果您: 1.想要用JavaScript编写测试代码 2.主要针对Angular JS应用

I'd say that if you: 1. want to write your test code in JavaScript 2. are focused on mainly Angular JS apps

您可能要考虑使用量角器.再次-那里没有魔术.他们所做的一切都包含在其源代码中-因此,如果您愿意坚持使用硒,就可以选择.

You might want to consider using Protractor. Again - no magic there. Everything they did is there in their source code - so you can just take your picks if you'd rather stick with selenium.

这篇关于可以使用硒自动使angularjs应用程序自动化吗?如果是,为什么要使用量角器?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆