ウェブページの変更をすべて一覧表示する方法はありますか?変更すると、ページに追加された新しいhtml要素、削除された古い要素、いくつかの要素の位置が変更されたことを意味します。ウェブページのすべての変更をリストする方法はありますか?
私はjavaでselenium web driverを使用しています。これは私のコードです:
@Test(dataProvider = "deviceName")
public void mobileEmulation(String deviceName, String url){
String ChromeDriverPath = "C:\\chromedriver_win32\\chromedriver.exe";
System.setProperty("webdriver.chrome.driver", ChromeDriverPath);
Map<String, String> mobileEmulation = new HashMap<String, String>();
mobileEmulation.put("deviceName", deviceName);
Map<String, Object> chromeOptions = new HashMap<String, Object>();
chromeOptions.put("mobileEmulation", mobileEmulation);
DesiredCapabilities capabilities = DesiredCapabilities.chrome();
capabilities.setCapability(ChromeOptions.CAPABILITY, chromeOptions);
WebDriver driver = new ChromeDriver(capabilities);
for (int i = 0 ; i < 2 ; i ++){
driver.get(url);
String source=driver.getPageSource();
}
driver.quit();
}
私はそれを行うにはどのようには考えているかを開始する場所から以来、私はこだわっていますか?
XHTMLの場合は、XMLUnit:http://javarevisited.blogspot.co.uk/2017/04/how-to-compare-two-xml-files-in-java.htmlを試してください。それがXHTMLでない場合、それを修正する方法があります:http://stackoverflow.com/questions/29087077/is-it-possible-to-convert-html-into-xhtml-with-jsoup-1-8-1 – slim