TECHNOLOGIES
FORUMS
JOBS
BOOKS
EVENTS
INTERVIEWS
Live
MORE
LEARN
Training
CAREER
MEMBERS
VIDEOS
NEWS
BLOGS
Sign Up
Login
No unread comment.
View All Comments
No unread message.
View All Messages
No unread notification.
View All Notifications
Answers
Post
An Article
A Blog
A News
A Video
An EBook
An Interview Question
Ask Question
Forums
Monthly Leaders
Forum guidelines
Nirmal Chakraborty
NA
5
4.7k
Can any 1 help me how to do data driven test using selenium
Aug 19 2013 7:56 AM
Dear Sir/Madam
I have written this code for selenium c sharp web driver.i want to bind csv file to extract value from the csv file but i am getting error like this
Test method SeleniumTest_1.Automationusing_selenium.TestCurrencyConvertorDDT threw exception:
OpenQA.Selenium.Support.UI.UnexpectedTagNameException: Element should have been select but was input
and line where i am getting error is
var selectinto = new SelectElement(setValueInto);
This is my full code
var convertVal = TestContext.DataRow["FirstCountryByText"].ToString();
var intoval = TestContext.DataRow["SecondCountryByText"].ToString();
var input = TestContext.DataRow["Input"].ToString();
var expectedValue = TestContext.DataRow["ExpectedValue"].ToString();
driver.Navigate().GoToUrl("http://www.oanda.com/currency/converter/");
//driver.FindElement(By.Id("quote_amount_input")).Clear();
//driver.FindElement(By.Id("quote_amount_input")).SendKeys("1");
var setValueConvert = driver.FindElement(By.Id("quote_currency_input"));
var setValueInto = driver.FindElement(By.Id("base_currency_input"));
var inputt = driver.FindElement(By.Id("quote_amount_input"));
var transfervalue = driver.FindElement(By.Id("base_amount_input"));
var selectConvertItem = new SelectElement(setValueConvert);
var selectinto = new SelectElement(setValueInto);
var inputte = new SelectElement(inputt);
var convertval=new SelectElement(transfervalue);
selectConvertItem.SelectByText(convertVal);
selectConvertItem.SelectByText(intoval);
selectConvertItem.SelectByValue(input);
var currencyValue = transfervalue.GetAttribute("value");
Thread.Sleep(900);
Assert.AreEqual(expectedValue, currencyValue);
Reply
Answers (
0
)
image tag URL dynamically
Disable Browser refresh button in all browser