0
我有一個URL列表,我需要拍攝它們的快照。 我正在使用cmd運行selenium服務器並在eclipse中運行以下代碼。在java中使用selenium拍攝不同網頁的快照
package com.example.tests;
import com.thoughtworks.selenium.DefaultSelenium;
import com.thoughtworks.selenium.Selenium;
public class MainClass {
void func(String url, String file)
{
Selenium selenium = new DefaultSelenium("localhost", 4444, "*firefox", url);
selenium.start();
selenium.windowMaximize();
selenium.open("/");
selenium.waitForPageToLoad("30000");
System.out.println("laoded\n");
// selenium.wait();
String file1= "C:\\test\\"+file+".png";
String file2= "C:\\test\\"+file+"2.png";
selenium.captureScreenshot(file1);
selenium.captureEntirePageScreenshot(file2, "");
selenium.stop();
}
public static void main(String[] args)
{
MainClass demo = new MainClass();
demo.func("http://www.facebook.com","face");
demo.func("www.reddit.com","reddit");
}
}
它給 this error
我通過these links去,但無法找到一個解決方案。 請幫助我如何解決這個問題。我對硒很陌生。
謝謝你工作正常,但在IE的情況下,它給這個錯誤http://imgur.com/YYOVy。 – Amit 2012-07-16 16:36:26
沒關係。它現在已經修復了。我在這裏找到了解決方案http://www.testerinyou.blogspot.com/。 – Amit 2012-07-16 17:11:45