Превъртете надолу javascript selenium

Примерен код

4
0

като търся в selenium

 Selenium does not have a method for scrolling
 but there are some ways to scroll:
 
   #1 ->=moveToElement= coming from Actions class
   will scroll down and up to given web element
   #2 Using JSExecutor: We can inject JavaScript
   code in our Java+Selenium code using JSExecutor
   which helps us scroll up, down, left, right.
   We need to create instance of JS executor,
   then cast our driver type of it.
==================================================   
   
  syntax is =   
   JavaScriptExecutor js = (JavaScriptExecutor) Driver.getDriver();
   js.executeScript("in here we need to pass js code that scrolls");
    
  
     js.executeScript("window.scrollBy(0,250)");
     js.executeScript("arguments[0].scrollIntoView(true);", WebElement);
0
0

javascript превъртете надолу

// To scroll to the bottom of a div
const theElement = document.getElementById('elementID');

const scrollToBottom = (node) => {
	node.scrollTop = node.scrollHeight;
}

scrollToBottom(theElement); // The specified node scrolls to the bottom.
0
0

превъртете надолу selenium java

import org.openqa.selenium.JavascriptExecutor;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.chrome.ChromeDriver;
import org.testng.annotations.Test;

public class ScrollByPixel {

    WebDriver driver;
    @Test
    public void ByPixel() {
        System.setProperty("webdriver.chrome.driver", "E://Selenium//Selenium_Jars//chromedriver.exe");
        driver = new ChromeDriver();

        JavascriptExecutor js = (JavascriptExecutor) driver;

        // Launch the application		
        driver.get("http://demo.guru99.com/test/guru99home/");

        //To maximize the window. This code may not work with Selenium 3 jars. If script fails you can remove the line below		
        driver.manage().window().maximize();

        // This  will scroll down the page by  1000 pixel vertical		
        js.executeScript("window.scrollBy(0,1000)");
    }
}

Подобни страници

Подобни страници с примери

На други езици

Тази страница на други езици

Русский
..................................................................................................................
English
..................................................................................................................
Italiano
..................................................................................................................
Polski
..................................................................................................................
Română
..................................................................................................................
한국어
..................................................................................................................
हिन्दी
..................................................................................................................
Français
..................................................................................................................
Türk
..................................................................................................................
Česk
..................................................................................................................
Português
..................................................................................................................
ไทย
..................................................................................................................
中文
..................................................................................................................
Español
..................................................................................................................
Slovenský
..................................................................................................................
Íslensk
..................................................................................................................