我尝试使用selenium访问https://signin.ebay.com/ws/eBayISAPI.dll?SellItem并使用HTMLunit作为驱动程序,但我收到了很多错误。我已经使用firefox驱动程序测试了我的代码,一切都运行良好。
这就是我设置驱动程序的方式:(我尝试过不同的浏览器版本)
HtmlUnitDriver driver = new HtmlUnitDriver(BrowserVersion.FIREFOX_24);
driver.setJavascriptEnabled(true);
输出包含许多错误,例如:
Obsolete content type encountered: 'text/javascript
WARNING: CSS warning: 'https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&ru=http%3A%2F%2Fwww.ebay.com%2F' [1:1687] Ignoring the whole rule.
但是,我认为真正的问题是javascript执行错误。控制台也输出了这个:
TypeError: Cannot set property "_l" of null to "function () {
var js = this.createElement("script");
if (dom) {
this.domain = dom;
}
js.id = "js-iframe-async";
js.src = rtmAsyncURL;
this.body.appendChild(js);
}" (script in https://signin.ebay.com/ws/eBayISAPI.dll?SignIn&ru=http%3A%2F%2Fwww.ebay.com%2F from (10, 5429) to (15, 10)#13)
我不太确定如何解决这个问题,任何有关通过HTMLunit访问Ebay的帮助都将非常感激。