سؤال

This is an error I get when I try to navigate to page, using HtmlUnitDriver:

JavaScript and Cookies need to be supported in order to use the site. To be able to use all of the site's functions, download and install one of the following browsers

WebDriver driver = new HtmlUnitDriver();
driver.get(url);
هل كانت مفيدة؟

المحلول

Turn on JavaScript just by passing in true to the constructor. By Default JavaScript is false so you have to use following code for the same:

WebDriver driver = new HtmlUnitDriver(true);
driver.get(url);

نصائح أخرى

HtmlUnitDriver driver = new HtmlUnitDriver();
driver.setJavascriptEnabled(true);

or

HtmlUnitDriver driver = new HtmlUnitDriver(true);
مرخصة بموجب: CC-BY-SA مع الإسناد
لا تنتمي إلى StackOverflow
scroll top