I was using selenium rc and ruby a few months back.
Today when I tried using it, there are a lot of changes and there is no documentation.
Let me go through the differences between old and new.
Old
Download selenium remote control. It is a zip file. Unzip the file.
Now you will find the selenium server ( a jar file which u have to run from the command prompt) and the selenium client for ruby ( a driver file in the respective language, ie for ruby, u may expect selenium.rb)
Just copy selenium.rb to the project . In Netbeans IDE, u have to right click project, select properties, add to project ( jar or folder) and select the appropriate client driver.
New
In the ruby client folder, no selenium.rb exists. A doc folder is present which asks us to install the selenium gem.
Great, now it is a gem, but what am i supposed to do after that. I installed the gem.
When i run the ruby tests, a lot of errors come up. When i google for these errors, no help comes up.
Dot net to the rescue
I created a "test project" in visual studio 2008. Added the references, (by right clicking references and selecting browse -> selecting all the dlls inside the dot net client driver folder (inside remote control) ) and then copy pasted the code from selenium ide. Wonder of wonders! it works!!
From the code window, here is a sample test which verifies some basic test on the application ui.
using System;
using System.Text;
using System.Text.RegularExpressions;
using System.Threading;
using NUnit.Framework;
using Selenium;
namespace SeleniumTests
{
[TestFixture]
public class NewTest
{
private ISelenium selenium;
private StringBuilder verificationErrorsa;
[SetUp]
public void SetupTest()
{
selenium = new DefaultSelenium("localhost", 4444, "*chrome", "http://buytickets.thetrainline.com/");
selenium.Start();
verificationErrors = new StringBuilder();
}
[TearDown]
public void TeardownTest()
{
try
{
selenium.Stop();
}
catch (Exception)
{
// Ignore errors if unable to close the browser
}
Assert.AreEqual("", verificationErrors.ToString());
}
[Test]
public void TheNewTest()
{
selenium.Open("/");
try
{
Assert.IsTrue(selenium.IsTextPresent("Buy train tickets"));
}
catch (AssertionException e)
{
verificationErrors.Append(e.Message);
}
selenium.Click("dnn_ctr24339_TissipGenericForm_LoginStatusAndRedirector.LoginStatus");
selenium.WaitForPageToLoad("30000");
try
{
Assert.IsTrue(selenium.IsTextPresent("Log in"));
}
catch (AssertionException e)
{
verificationErrors.Append(e.Message);
}
selenium.Click("//a[@id='dnn_ctr24339_TissipGenericForm_LoginStatusAndRedirector.Home']/span");
selenium.WaitForPageToLoad("30000");
try
{
Assert.IsTrue(selenium.IsTextPresent("Buy train tickets"));
}
catch (AssertionException e)
{
verificationErrors.Append(e.Message);
}
}//end of new test
}
}
6 comments:
精彩的文章是我停留的理由~........................................
我從來不認為不同意我的看法就是冒犯 ..................................................
Hey Manoj, Please cancel the auto-forward or the filter in your gmail which is forwarding mails to my inbox. Your mails are overflowing my inbox.
裸照裸女愛愛無碼尋夢視訊聊天a漫a片a圖一夜情一葉情人妻激情情色寫真美女自拍辣妹自拍正妹自拍美女走光辣妹走光正妹走光脫衣秀脫衣走光色情自慰自拍成人全裸打炮打手槍打飛機巨乳巨奶女優大奶
may the blessing be with you.........................................
色情網小說色情秀一夜聊天室女同聊天聊天室二免費看日本女優免費看外國片免費看色短片免費看做愛片免費看做愛短片免費看彩虹頻道免費看影片a片免費看線上影片免費限制卡通免費限遊戲免費真人影片免費情色影片線上直播免費男同志片後宮電影院免費成人短片線上看免費成人短片論壇免費成人短片觀看免費成人愛影片免費成人電影線上觀看免費成人圖貼免費成人影片g免費成人影片go2免費成人影片免免費成人影片網站免費成人影?凹凸色色卡通圖片免費即時通視訊情色文學交友覓戀會館
Post a Comment