我试图与webdriver一起工作,看看黄瓜是否会用junit打开浏览器。除了打开网页浏览器,甚至做我要求做的事情之外,它都认识到一切。以下是代码片段:黄瓜Junit测试代码
public class JobSearch {
WebDriver driver;
@Test
public void JobSearchSteps()
{
driver = new FirefoxDriver();
driver.navigate().to("http://www.careerbuilder.com");
}
@Given("^I am on the page Find Jobs$")
public void I_am_on_the_page_Find_Jobs()throws Throwable{
System.out.println("******************************");
System.out.println("@Given -- I am on the page Find Jobs");
}
@When("^I enter \"([a-zA-Z]{1,})\" in the Keywords textbox$")
public void I_enter_QA_in_the_Keywords_textbox(String Job){
driver.findElement(By.id("s_rawwords")).sendKeys(Job);
System.out.println("The search is "+Job);
}
@And("^I enter\"([a-zA-Z]{1,})\" in the Location textbox$")
public void I_enter_my_location_in_the_Location_textbox(String Loc)throws Throwable{
System.out.println("The location is "+ Loc);
driver.findElement(By.id("s_freeloc")).sendKeys(Loc);
}
@And ("^I Select\"([a-zA-Z]{1,})\" from the Careers Category List$")
public void I_Select_from_the_Careers_Category_List(String Option)throws Throwable{
WebElement ListBox =driver.findElement(By.id("s_jobtypes"));
List options = ListBox.findElements(By.tagName(Option));
}
@And ("^I click the button Find Jobs$")
public void I_click_the_button_Find_Jobs()throws Throwable{
driver.findElement(By.id("qsbButton")).click();
}
@Then("^the page Jobs should be shown$")
public void the_page_Jos_should_be_shown()throws Throwable{
}
}
什么引发错误? – Bala
org.openqa.selenium.WebDriverException:f.QueryInterface不是一个函数。特点:职位搜索 为了得到一份工作 作为QA 我需要寻找它 场景:搜寻工作 鉴于我在页面上搜索职位 当我在关键词文本 我输入“”在位置文本框中输入“” 而我从职业类别列表中选择“信息技术” 然后我单击按钮“查找职位” 然后页面“职位”应该显示 –
Emily