|
网上查到的是这样:- // You may use any WebDriver implementation. Firefox is used here as an example
- WebDriver driver = new FirefoxDriver();
- // A "base url", used by selenium to resolve relative URLs
- String baseUrl = "http://www.google.com";
- // Create the Selenium implementation
- Selenium selenium = new WebDriverBackedSelenium(driver, baseUrl);
- // Perform actions with selenium
- selenium.open("http://www.google.com");
- selenium.type("name=q", "cheese");
- selenium.click("name=btnG");
- // And get the underlying WebDriver implementation back. This will refer to the
- // same WebDriver instance as the "driver" variable above.
- WebDriver driverInstance = ((WebDriverBackedSelenium) selenium).getUnderlyingWebDriver();
复制代码 现在的问题是就是提示getUnderlyingWebDriver这个方法未定义. 导入的包如下:
import org.junit.Test;
import org.openqa.selenium.By;
import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriverBackedSelenium;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.ie.InternetExplorerDriver;
import org.openqa.selenium.support.ui.Select;
import org.openqa.selenium.server.RemoteControlConfiguration;
import org.openqa.selenium.server.SeleniumServer;
import com.thoughtworks.selenium.Selenium;
是还缺少什么包? 还是什么情况,请知道的朋友帮助解决,多谢! |
|