9 Important Tips for Selenium Remote Control (Java client) - Test Tool 9重要提示硒遠程控制( Java客戶端) -測試工具
Selenium Remote Control (RC) is a test tool that allows you to write automated web application UI tests in many programming languages against any HTTP website using any mainstream JavaScript-enabled browser.硒遠程控制( RC )的是一個測試工具,可讓您寫的自動化Web應用程序的UI測試,在許多編程語言,對任何HTTP的網站,使用任何主流啟用了JavaScript的瀏覽器。 Selenium RC is a powerful and simple framework for running (scheduled or manually) automated UI centric regression tests for web applications / services.硒區局是一個強大的和簡單的框架,運行(定或手動)自動化的用戶界面為中心的回歸測試的Web應用程序/服務。 Here are few simple tips for Selenium RC java client.這裡有幾個簡單的提示硒區局Java客戶端。 I used JUnit for tests.我用junit測試。 You can use NGUnit too.您可以使用ngunit太。
1. 1 。 To run the Java client you need to only have selenium-java-client-driver.jar (located in selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1 ) in your classpath.運行Java客戶端,您需要只有硒Java的客戶端- driver.jar (設在selenium-remote-control-1.0-beta-1/selenium-java-client-driver-1.0-beta-1 )在您的classpath下。
2. 2 。 The automatically generated java file (from Selenium Core) is likely to be defective.自動生成的Java文件(從硒核心)很可能是有缺陷的。 Ensure at least you have the following import statements:確保至少你有以下的進口聲明:
import com.thoughtworks.selenium.*; 進口com.thoughtworks.selenium .* ;
import junit.framework.*; 進口junit.framework .* ;
import java.util.regex.Pattern; 進口java.util.regex.pattern ;
3. 3 。 Ensure that the saved file name matches the generated class file name.確保保存的文件名稱相匹配的生成的類文件名。
4. 4 。 Remove the package statement or replace it with your own package statement.刪除包聲明或取代它與自己的包聲明。 Initially just remove it.最初只是將它移除。
5. 5 。 Error: java.lang.UnsupportedOperationException: Catch body broken: IOException from cmd=setContext&1=SeleniumSTSanityTest.testSimpleThoughts -> java.net.ConnectException: Connection refused錯誤: java.lang.unsupportedoperationexception :趕上身體破碎: ioexception從cmd = setcontext & 1 = seleniumstsanitytest.testsimplethoughts -> “ j ava.net.connectexception:連接被拒
Have you run the Selenium server?有您運行硒服務器?
Run the Selenium server like this:運行中硒的服務器是這樣的:
java -jar selenium-server.jar Java的罐子硒server.jar
The selenium server is located in:硒是服務器設在:
selenium-remote-control-1.0-beta-1/selenium-server-1.0-beta-1
6. 6 。 Error: com.thoughtworks.selenium.SeleniumException: ERROR Server Exception: sessionId should not be null; has this session been started yet?錯誤: com.thoughtworks.selenium.seleniumexception :錯誤的服務器例外: sessionid不應該無效;已經本次會議已經開始了沒?
Ensure that the browser is in the PATH before running the server.確保瀏覽器是在道路之前,運行服務器。 On my linux box I did:對我的Linux方塊我:
export PATH=$PATH:/usr/lib/firefox-2.0.0.6/ 出口的路徑= $路徑: / usr/lib/firefox-2.0.0.6 /
7. 7 。 Error: com.thoughtworks.selenium.SeleniumException: Permission denied to get property Location.href錯誤: com.thoughtworks.selenium.seleniumexception :許可被拒絕獲得的財產location.href
This happens on Firefox when a previous page wasn’t fully loaded before the next page was invoked (due to timeout or click() was used).這種情況在Firefox時,前一頁是沒有滿載前,下一頁引用(因超時或點擊( )用) 。 The solution is to use *chrome instead of *firefox in setup.解決的辦法是使用*鉻而不是* Firefox的安裝程序。 I use for firefox:我使用Firefox的:
setUp(”http://blog.taragana.com/”, “*chrome”); 安裝( “ http://blog.taragana.com/ ” , “ *鉻” ) ;
8. 8 。 Timeout error超時錯誤
Increase the time in selenium.waitForPageToLoad() to 60000 (1 minute) or more.增加的時間在selenium.waitforpagetoload ( ) 60000 ( 1分鐘)或以上。
9. 9 。 How to run the generated java Test file?如何運行所產生的Java測試文件?
This is really a JUnit question but in short you can add the following code in the generated file to get it running:這真是一個junit問題,但在短期內,您可以添加以下代碼,在生成的文件,以獲得它的運行:
public static Test suite() { return new TestSuite( SeleniumSTSanityTest .class); } public static void main(String args[]) { junit.textui.TestRunner.run(suite()); }公共靜態測試套件( ) (返回新testsuite ( seleniumstsanitytest 。級) ; )公共靜態無效的主要(字符串args [ ] ) ( junit.textui.testrunner.run (套房( ) ) ; ) Note: Replace SeleniumSTSanityTest with the name of your Java source file (without the .java extension)注:取代seleniumstsanitytest與名稱,您的Java源文件(沒有。 Java的擴展部分)
Filed under提起下 Browser瀏覽器 , , Firefox火狐 , , Headline News頭條新聞 , , Internet Explorer Internet Explorer中 , , Java Software Java軟件 , , Javascript JavaScript的 , , Programming編程 , , Web網頁 , , Web 2.0 Web 2.0的 , , Web Services Web服務 | |
| |
RSS 2.0 2.0 | |
Trackback Trackback跟踪 this Article |此文章|
Email this Article電子郵件此文章
You may also like to read您也可以想讀 |





May 23rd, 2008 at 11:28 am 2008年5月23日在上午11時28分
You have made my life a joy.你說了我生命的喜悅。
June 22nd, 2008 at 9:38 pm 2008年6月22日在下午9點38分
it is cool.這是很酷。