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

Div click function doesn't work #187

Open a03201 opened 7 years ago

a03201 commented 7 years ago

I execute the following click funtion, but it fails. I have no clue why this is not function. Code is followed:

        JBrowserDriver driver = new JBrowserDriver(Settings.builder().userAgent(UserAgent.CHROME).build());

        // This will block for the page load and any
        // associated AJAX requests
        driver.get( "http://weixin.sogou.com/weixin?type=1&query=tangdaoya&ie=utf8&_sug_=n&_sug_type_="
        );

        // You can get status code unlike other Selenium drivers.
        // It blocks for AJAX requests and page loads after clicks
        // and keyboard events.
        System.out.println(driver.getPageSource());
        WebElement webElement=driver.findElementById("sogou_vr_11002301_box_0");
        //webElement=driver.findElementById("sogou_pic");

        System.out.println("element");
        System.out.println("element:"+webElement.getTagName());
        System.out.println("click");

        webElement.click();

        driver.pageWait();
        System.out.println("click finish");
        System.out.println(driver.getPageSource());

        // Close the browser. Allows this thread to terminate.
        driver.quit();