Page MenuHomePhabricator

VisualEditorExample.java

Authored By
bzimport
Nov 22 2014, 2:28 AM
Size
1 KB
Referenced Files
None
Subscribers
None

VisualEditorExample.java

package com.jeff.webdriver;
import java.util.concurrent.TimeUnit;
import org.openqa.selenium.By;
import org.openqa.selenium.Keys;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.firefox.FirefoxDriver;
import org.openqa.selenium.JavascriptExecutor;
public class VisualEditorExample {
public static void main(String[] args) throws Exception {
WebDriver driver = new FirefoxDriver();
driver.get("https://test2.wikipedia.org/wiki/User:Selenium_user/cursor_test_page_chromedriver_bug");
driver.findElement(By.linkText("Edit")).click();
driver.manage().timeouts().implicitlyWait(5, TimeUnit.SECONDS);
driver.switchTo().frame(0);
driver.findElement(By.xpath("//span[text()='Continue']")).click();
driver.switchTo().defaultContent();
WebElement editText = driver.findElement(By.xpath("//div[@class='ve-ce-documentNode ve-ce-branchNode noime']"));
int x = 0;
while (x < 32) {
editText.sendKeys(Keys.ARROW_RIGHT);
String testJs = "return new XMLSerializer().serializeToString(document.activeElement);";
JavascriptExecutor js = (JavascriptExecutor) driver;
System.out.println(js.executeScript(testJs));
x++;
}
driver.close();
}
}

File Metadata

Mime Type
text/x-c
Storage Engine
blob
Storage Format
Raw Data
Storage Handle
11855
Default Alt Text
VisualEditorExample.java (1 KB)

Event Timeline