2

I'm getting the below error while page transition, by clicking on submit button. It looks like there was an issue with the newest Chrome release. Without the disable-gpu Chromeoption set, the renderer will occasionally timeout. The workaround until Google fixes this (if they do fix it at all) is to add the --disable-gpu attribute to the ChromeOptions.

Error-message:

    Launching the chrome driver  
    Starting ChromeDriver 2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e) on port 8737
    Only local connections are allowed.
    Aug 22, 2018 10:02:06 AM org.openqa.selenium.remote.ProtocolHandshake createSession
    INFO: Detected dialect: OSS
    [1534912350.875][SEVERE]: Timed out receiving message from renderer: 20.000
    [1534912350.881][SEVERE]: Timed out receiving message from renderer: -0.010
    iiiiiiiiiiiiiiiiiii
    [1534912370.909][SEVERE]: Timed out receiving message from renderer: 20.000
    [1534912370.909][SEVERE]: Timed out receiving message from renderer: -0.001
    Exception in thread "main" org.openqa.selenium.TimeoutException: timeout
      (Session info: chrome=68.0.3440.106)
      (Driver info: chromedriver=2.41.578737 (49da6702b16031c40d63e5618de03a32ff6c197e),platform=Windows NT 10.0.17134 x86_64) (WARNING: The server did not provide any stacktrace information)
    Command duration or timeout: 0 milliseconds
    Build info: version: '3.14.0', revision: 'aacccce0', time: '2018-08-02T20:05:20.749Z'
    System info: host: 'LAPTOP-B3DIN1KF', ip: '192.168.43.235', os.name: 'Windows 10', os.arch: 'x86', os.version: '10.0', java.version: '1.8.0_161'
    Driver info: org.openqa.selenium.chrome.ChromeDriver
    Capabilities {acceptInsecureCerts: false, acceptSslCerts: false, applicationCacheEnabled: false, browserConnectionEnabled: false, browserName: chrome, chrome: {chromedriverVersion: 2.41.578737 (49da6702b16031..., userDataDir: C:\Users\ACER-S~1\AppData\L...}, cssSelectorsEnabled: true, databaseEnabled: false, goog:chromeOptions: {debuggerAddress: localhost:49380}, handlesAlerts: true, hasTouchScreen: false, javascriptEnabled: true, locationContextEnabled: true, mobileEmulationEnabled: false, nativeEvents: true, networkConnectionEnabled: false, pageLoadStrategy: normal, platform: XP, platformName: XP, rotatable: false, setWindowRect: true, takesHeapSnapshot: true, takesScreenshot: true, unexpectedAlertBehaviour: , unhandledPromptBehavior: , version: 68.0.3440.106, webStorageEnabled: true}
    Session ID: b3de58666d2ca24706dc70a9d78094e4
    *** Element info: {Using=css selector, value=body > div > div > div > h1 > a}
        at sun.reflect.NativeConstructorAccessorImpl.newInstance0(Native Method)
        at sun.reflect.NativeConstructorAccessorImpl.newInstance(Unknown Source)
        at sun.reflect.DelegatingConstructorAccessorImpl.newInstance(Unknown Source)
        at java.lang.reflect.Constructor.newInstance(Unknown Source)
        at org.openqa.selenium.remote.ErrorHandler.createThrowable(ErrorHandler.java:214)
        at org.openqa.selenium.remote.ErrorHandler.throwIfResponseFailed(ErrorHandler.java:166)
        at org.openqa.selenium.remote.http.JsonHttpResponseCodec.reconstructValue(JsonHttpResponseCodec.java:40)
        at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:80)
        at org.openqa.selenium.remote.http.AbstractHttpResponseCodec.decode(AbstractHttpResponseCodec.java:44)
        at org.openqa.selenium.remote.HttpCommandExecutor.execute(HttpCommandExecutor.java:158)
        at org.openqa.selenium.remote.service.DriverCommandExecutor.execute(DriverCommandExecutor.java:83)
        at org.openqa.selenium.remote.RemoteWebDriver.execute(RemoteWebDriver.java:548)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:322)
        at org.openqa.selenium.remote.RemoteWebDriver.findElementByCssSelector(RemoteWebDriver.java:416)
        at org.openqa.selenium.By$ByCssSelector.findElement(By.java:431)
        at org.openqa.selenium.remote.RemoteWebDriver.findElement(RemoteWebDriver.java:314)
        at demoPackage.Demo.main(Demo.java:102)

Using the script:

    package demoPackage;
        
        import java.util.concurrent.TimeUnit;
        
        import org.openqa.selenium.By;
        import org.openqa.selenium.JavascriptExecutor;
        import org.openqa.selenium.Keys;
        import org.openqa.selenium.Point;
        import org.openqa.selenium.WebDriver;
        import org.openqa.selenium.WebElement;
        import org.openqa.selenium.chrome.ChromeDriver;
        import org.openqa.selenium.chrome.ChromeOptions;
        import org.openqa.selenium.edge.EdgeDriver;
        import org.openqa.selenium.remote.DesiredCapabilities;
        import org.openqa.selenium.support.ui.ExpectedConditions;
        import org.openqa.selenium.support.ui.WebDriverWait;
        
        import com.codoid.products.exception.FilloException;
        
        /**
         * @author Acer-sumit
         * 
         */
        public class Demo {
        
            public static WebDriver driver = null;
            public static JavascriptExecutor js;
        
            public static void main(String args[]) throws FilloException, InterruptedException {
                
                
                
                System.out.println("Launching the chrome driver  ");
                // Set the chrome driver exe file path
                System.setProperty("webdriver.chrome.driver","E:\\selenium_sumit\\chromedriver_win32_2.40\\chromedriver.exe");
                ChromeOptions options = new ChromeOptions();
                options.addArguments("--disable-gpu");
                options.addArguments("--disable-browser-side-navigation");
                
                // Instantiate the chrome driver
                driver = new ChromeDriver(options);
                
                ///System.setProperty("webdriver.edge.driver","E:\\MicrosoftWebDriver.exe");
                //driver = new EdgeDriver();
                
                
                //driver.manage().timeouts().implicitlyWait(6000, TimeUnit.MILLISECONDS);
                driver.manage().timeouts().pageLoadTimeout(20,TimeUnit.SECONDS);
                //driver.manage().timeouts().setScriptTimeout(60, TimeUnit.SECONDS);
                // set the browser URL in get() to load the webpage
                
                try {
            
                    driver.navigate().to("https://diggza.com/");
                    driver.findElement(By.cssSelector("input[name='url']")).clear();
                    driver.findElement(By.cssSelector("input[name='url']")).sendKeys("https://www.google.com/");
                    driver.findElement(By.cssSelector("input[name='email']")).sendKeys("sdsjsnssk@gmail.com");
                    driver.findElement(By.cssSelector("#myform > p:nth-child(5) > a:nth-child(1)")).click();
                    
                    //wait for element to be visible and perform click
                    //wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input[type='submit']")));
                    
                    
                        js = (JavascriptExecutor)driver;
                        js.executeScript("arguments[0].click();", driver.findElement(By.cssSelector("input[type='submit']")));
                    } catch (Exception e) {
                        // TODO Auto-generated catch block
                        System.out.println("iiiiiiiiiiiiiiiiiii");
                        driver.findElement(By.cssSelector("body > div > div > div > h1 > a")).click();
                        //driver.navigate().refresh();
                        
                        
                    }
                
                //driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
                
                System.out.println("-------fffffffffff---------");
                driver.get("https://diggza.com/");
                
                driver.findElement(By.cssSelector("input[name='url']")).clear();
                driver.findElement(By.cssSelector("input[name='url']")).sendKeys("https://www.google.com/");
                driver.findElement(By.cssSelector("input[name='email']")).sendKeys("sumit.pradhan96@gmail.com");
                driver.findElement(By.cssSelector("#myform > p:nth-child(5) > a:nth-child(1)")).click();
                
                //wait for element to be visible and perform click
                //wait.until(ExpectedConditions.visibilityOfElementLocated(By.cssSelector("input[type='submit']")));
                driver.findElement(By.cssSelector("input[type='submit']")).click();
                //driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
                
                
            }   
        
        
        
        }

kaliiiiiiiii
  • 925
  • 1
  • 2
  • 21
sumit kumar pradhan
  • 614
  • 1
  • 6
  • 12

0 Answers0