Всем привет. Подскажите если кто знает как в можно в селениум тестах в браузере поменять прокси. В фаерфоксе вроди как можно. Но у меня почему-то не получается через вебдрайвер запустить даже. Делаю так. | Код |
import org.openqa.selenium.By; import org.openqa.selenium.WebDriver; import org.openqa.selenium.WebElement; import org.openqa.selenium.firefox.FirefoxDriver;
public class GoogleTest { public static void main(String[] args) throws Exception{ WebDriver driver = new FirefoxDriver(); // 10 строка
// And now use this to visit Google driver.get("http://www.google.com");
// Find the text input element by its name WebElement element = driver.findElement(By.name("q"));
// Enter something to search for element.sendKeys("Cheese!");
// Now submit the form. WebDriver will find the form for us from the element element.submit();
// Check the title of the page System.out.println("Page title is: " + driver.getTitle()); //Close the browser driver.quit(); } }
|
И выдает ошибку | Код | Exception in thread "main" java.lang.NoClassDefFoundError: com/google/common/base/Function at GoogleTest.main(GoogleTest.java:10) Caused by: java.lang.ClassNotFoundException: com.google.common.base.Function at java.net.URLClassLoader$1.run(Unknown Source) at java.security.AccessController.doPrivileged(Native Method) at java.net.URLClassLoader.findClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) at sun.misc.Launcher$AppClassLoader.loadClass(Unknown Source) at java.lang.ClassLoader.loadClass(Unknown Source) ... 1 more
|
Это кстати пример а не я сам придумал. И еще хотел узнать настройки прокси в браузере так меняются? | Код | Proxy proxy = new Proxy(); proxy.setAutodetect(true); FirefoxProfile profile = new FirefoxProfile(); profile.setProxyPreferences(proxy); WebDriver driver = new FirefoxDriver (profile);
|
|