nayaz jh
nayaz jh

Reputation: 21

Selenium web Driver retrieve response

how to retrieve response text generated in browser after executing script in selenium web drive.in the above figure the underlined response I want to retrieve and store it in a string. //Opening the web page driver = new ChromeDriver();

        System.setProperty("webdriver.chrome.driver", "/usr/local/share/chromedriver");
        driver.get(Mymark.str);

//Opening the login page
        WebElement login= driver.findElement
       (By.xpath("//a[text()='Log in']"));

     login.click();

// Enter Username 
     WebElement Usrnm=driver.findElement
       (By.xpath("//div[@id='mainContainer']//mymark-login[@class='x-scope mymark-login-0']//input[@name='uname']"));
     Usrnm.sendKeys("nayazjh");


//Enter Password
    WebElement Pswd= driver.findElement
      (By.xpath("//div[@class='content']//div[@class='loginlayout layout vertical justified style-scope mymark-login']//input[@name='password']"));
    Pswd.sendKeys("doordie");


 //click on remember me button
         driver.findElement(By.xpath( "//div[@id='toggleButton']")).click();

 //Click on login button   
        WebElement logIn= driver.findElement
        (By.xpath("//div[@class='lsubmitarea style-scope mymark-login']//paper-button[text()='Log in']"));
     logIn.click();

     driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);

     driver.findElement
     (By.xpath("//paper-button[text()='Add Bookmark Group ']")).click();



     driver.findElement
     (By.xpath("//paper-dialog[@id='addgroupdialog']//input[@id='input']")).sendKeys("selenium71");



   element =  driver.findElement
     (By.xpath("//paper-dialog[@id='addgroupdialog']//div[@class='adddialogsubmit style-scope mymark-addgroup']" +
            "//paper-button[@id='addgroupbutton']"));
      element.click();


here i need a code to retrieve the response in java 




}

image1

The above image shows the response I want to get it using selenium or java how to retrieve response text generated in browser after executing script in selenium web drive.in the above figure the underlined response I want to retrieve and store it in a string.

Upvotes: 1

Views: 965

Answers (1)

samjaf
samjaf

Reputation: 1053

As far as I know it is impossible for selenium to get the actual response.

Selenium is build "on top". It can not directly control how the browser interacts with the server nor is it supposed to support this kind of control.

Selenium is thought as an ui automation framework, i.e. clicking and asserting ui state. It is not meant to intercept browser-server communication.

Upvotes: 1

Related Questions