MachinePublishers / jBrowserDriver

A programmable, embeddable web browser driver compatible with the Selenium WebDriver spec -- headless, WebKit-based, pure Java
Other
809 stars 143 forks source link

Adding to webkitNavigator is not working? #296

Open arya6000 opened 6 years ago

arya6000 commented 6 years ago

I have modified the file UserAgent.java and I have added "webkitNavigatorTmp.put("languages", "'en-US'");" to the webkitNavigator String. But when I go to whoer.net I still do not see the languages under the navigator section. I also tried adding a few other things, but they do not appear when I go to whoer.net. Why is that?

    static {
        Map<String, String> webkitNavigatorTmp = new LinkedHashMap<String, String>();
        webkitNavigatorTmp.put("vendorSub", "''");
        webkitNavigatorTmp.put("productSub", "'20030107'");
        webkitNavigatorTmp.put("buildID", "'20030107'");
        webkitNavigatorTmp.put("appCodeName", "'Mozilla'");
        webkitNavigatorTmp.put("appName", "'Netscape'");
        webkitNavigatorTmp.put("product", "'Gecko'");
        webkitNavigatorTmp.put("languages", "'en-US'");
        webkitNavigator = buildNavigator(webkitNavigatorTmp);
    }

And this is how I run jBrowserDriver

    public static void main(String[] args) throws InterruptedException {
        UserAgent userAgent = new UserAgent(UserAgent.Family.WEBKIT, "Apple Computer, Inc.", "iPhone", "",
                "5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.0 Mobile/14G60 Safari/602.1",
                "Mozilla/5.0 (iPhone; CPU iPhone OS 10_3_3 like Mac OS X) AppleWebKit/603.3.8 (KHTML, like Gecko) Version/10.0 Mobile/14G60 Safari/602.1");

        JBrowserDriver driver = new JBrowserDriver(Settings.builder().timezone(Timezone.AMERICA_NEWYORK).headless(false)
                .blockAds(true).userAgent(userAgent).build());
        driver.get("http://whoer.net");
        Thread.sleep(15000000);
        driver.quit();
    }