在 Selenium 中,我可以通过以下方式定位项目及其 HTML:
driver.get('http://www.google.com/ncr');
driver.findElement(webdriver.By.id('hplogo')).getAttribute('outerHTML').then(
function(html) {
console.log(html);
});
我可以检索我得到的 HTML 的文件类型吗?例如,如果 HTML 记录如下:
<video src="http://www.myvideo.com/video.webm"></video>
我会得到以下输出:
webm