Selenium WebDriver (Java) - Actions, moveToElement, findElement, getCurrentURL

Pubblicato il: 23 maggio 2017
sul canale di: MSelenium Drive
596
8

Code view:

import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.interactions.Actions;

public class moveToElement {

public static void main(String[] args) {

System.setProperty("webdriver.chrome.driver", "C:\\Users\\Niko\\Desktop\\Sel_Drivers\\chromedriver_win32\\chromedriver.exe");
WebDriver a = new ChromeDriver();
a.get("https://www.amazon.com/");

Actions act = new Actions (a);
WebElement Departments = a.findElement(By.xpath(".//*[@id='nav-link-shopall']/span[2]"));
act.moveToElement(Departments).build().perform();

WebElement FireTablets = a.findElement(By.xpath(".//*[@id='nav-flyout-shopAll']/div[2]/span[5]/span"));
act.keyDown(Keys.SHIFT).moveToElement(FireTablets).build().perform();

act.moveToElement(a.findElement(By.xpath(".//*[@id='nav-flyout-shopAll']/div[3]/div[5]/div[2]/div/a[4]/span"))).keyDown(Keys.SHIFT).click().build().perform();

System.out.println(a.getCurrentUrl());

// https://www.amazon.com/Kindle-eBooks/...
}}


In questa pagina del sito puoi guardare il video online Selenium WebDriver (Java) - Actions, moveToElement, findElement, getCurrentURL della durata di ore minuti seconda in buona qualità , che l'utente ha caricato MSelenium Drive 23 maggio 2017, condividi il link con amici e conoscenti, su youtube questo video è già stato visto 596 volte e gli è piaciuto 8 spettatori. Buona visione!