如何在Selenium 3中运行或迁移html测试套件? [英] How do I run or migrate an html test suite in Selenium 3?

查看:147
本文介绍了如何在Selenium 3中运行或迁移html测试套件?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

Firefox最近已更新,现在版本为48.0,导致我的-htmlSuite测试失败。我从Firefox收到此错误消息:

It appears that Firefox has recently been updated, now at version 48.0, causing my -htmlSuite tests to fail. I'm getting this error message from Firefox:

Firefox can’t find the file at chrome://src/content/TestRunner.html

我目前正在使用Selenium Server版本2.53.1来运行我的测试记录在Firefox Selenium IDE插件中,然后在我的OS X开发服务器上自动完成。

I'm currently using Selenium Server version 2.53.1 in order to run my tests which were recorded in the Firefox Selenium IDE add-on, then automated on my OS X development server.

这些测试的目的是提供任何网站的每日概要,如果脚本无法导航到结尾,则需要对其进行审核。网站的购买工作流程。这是我写的一个bash脚本,用于启动我的功能测试:

The purpose of these tests is to provide a daily synopsis of any websites which need to be reviewed in the event that the script is not able to navigate to the end of the site's purchase workflow. Here is a bash script that I wrote to launch my functional tests:

#!/bin/bash
java -jar selenium-server-standalone-2.53.1.jar
     -htmlSuite "*firefox" "http://www.insureone.com"
                "/SeleniumTests/InsureOne-Suite.html" 
                "/SeleniumTests/InsureOne-Results.html" > /dev/null

java -jar selenium-server-standalone-2.53.1.jar
      -htmlSuite "*firefox" "http://www.aaffordableauto.com"            
       "/SeleniumTests/A-Affordable-Suite.html" 
       "/SeleniumTests/A-Affordable-Results.html" > /dev/null

echo "Finished"

以下是InsureOne的片段Suite唯一测试,导航前两页:

Here's a snippet from InsureOne Suite's only test, that navigates through the first two pages:

InsureOne-Test
setTimeout  60000   
open    /   
sendKeys    id=zipcode  60610
sendKeys    id=phone    3126548045
select  id=year label=2006
waitForElementPresent   //option[contains(.,'PONTIAC')] 
select  id=make label=PONTIAC
waitForElementPresent   //option[contains(.,'G6')]  
select  id=model    label=G6
clickAndWait    //button[contains(.,'Free Quote')]  
setTimeout  120000  
waitForElementPresent   id=getquote 
setTimeout  60000   
clickAndWait    id=getquote 

这些测试是使用Automator运行的,然后每天早上都会通过电子邮件将结果发送给我审核。

These tests are run with Automator, then the results are emailed to me each morning for review.

我有最初尝试使用最新版本的Selenium来启动我的测试,但是无法g工作。我无法在Selenium文档中找到任何内容来帮助我使用最新版本的Selenium运行html测试套件。

I had originally attempted to use the latest build of Selenium to launch my tests, but was unable to get that working. I've not been able to find anything in the Selenium docs to help me run an html test suite using the latest build of Selenium.

我不希望添加在Jenkins + Maven中运行的自动构建和正式单元测试的复杂性或在另一种语言中的等效测试。有没有办法在shell脚本中在Selenium 3中执行此操作?

I don't want the added complexity of automated builds and formal unit tests running in Jenkins + Maven or the equivalent in another language. Is there a way to do this in Selenium 3 from a shell script?

java -jar selenium-server-standalone-3.0.0-beta2.jar  
      -htmlSuite "*firefox" "http://www.aaffordableauto.com"            
       "/SeleniumTests/A-Affordable-Suite.html" 
       "/SeleniumTests/A-Affordable-Results.html" > /dev/null

此命令导致NullPointerException。我被困了,因为SeleniumHQ没有关于如何使其工作或将其迁移到最新版本的建议。

This command results in a NullPointerException. I'm stuck because there is no advice on SeleniumHQ about how to either get this working or migrate it to work on the newest release.

推荐答案

我还有另一种解决方法,切换到ChromeDriver让我可以再次使用selenium-server-standalone-2.53.1进行测试。我必须修改我的bash脚本以忽略由Selenium的代理证书引起的ssl错误。

I have yet another workaround, switching to the ChromeDriver allowed me to get the tests working on selenium-server-standalone-2.53.1 again. I did have to modify my bash script to ignore the ssl error caused by Selenium's proxy certificate.

#!/bin/bash
java -jar selenium-server-standalone-2.53.1.jar 
     -trustAllSSLCertificates 
     -htmlSuite "*googlechrome" "http://www.aaffordableauto.com"
                "/SeleniumTests/A-Affordable-Suite.html" 
                "/SeleniumTests/A-Affordable-Results.html" > /dev/null

java -jar selenium-server-standalone-2.53.1.jar
     -trustAllSSLCertificates
     -htmlSuite "*googlechrome" "http://www.insureone.com"
                "/SeleniumTests/InsureOne-Suite.html"
                "/SeleniumTests/InsureOne-Results.html" > /dev/null

echo "Finished"

这篇关于如何在Selenium 3中运行或迁移html测试套件?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

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