Created
April 26, 2011 16:45
-
-
Save andreastt/942635 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.opera.core.systems.OperaDriver; | |
import com.opera.core.systems.OperaWebElement; | |
import org.openqa.selenium.By; | |
//import org.openqa.selenium.WebElement; | |
public class MyTest { | |
public static void main(String[] args) throws InterruptedException { | |
OperaDriver driver = new OperaDriver(); | |
driver.navigate().to("http://maps.google.com/?hl=en"); | |
System.out.println("Find the search box"); | |
OperaWebElement search = (OperaWebElement) driver.findElement(By.id("q_d")); | |
System.out.println("Type text and submit the form"); | |
search.sendKeys("Opera Software ASA, Oslo to Den Norske Opera & Ballett"); | |
driver.key("Enter"); | |
Thread.sleep(2000); | |
System.out.println("Select the first result"); | |
driver.findElement(By.id("ddw_dll_1_0")).click(); | |
Thread.sleep(2000); | |
System.out.println("Pan down"); | |
driver.findElement(By.xpath("//div[@log='pan_down']")).click(); | |
System.out.println("Zoom in"); | |
OperaWebElement zoomIn = (OperaWebElement) driver.findElement(By.xpath("//div[@title='Zoom In']")); | |
System.out.println(zoomIn.getTagName()); | |
System.out.println(zoomIn.getAttribute("style")); | |
zoomIn.click(10,10); | |
zoomIn.click(10,10); | |
System.out.println("Done!"); | |
Thread.sleep(10000); | |
driver.quit(); | |
} | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import com.opera.core.systems.OperaDriver; | |
import com.opera.core.systems.OperaWebElement; | |
import org.openqa.selenium.By; | |
//import org.openqa.selenium.WebElement; | |
public class MyTest { | |
public static void main(String[] args) throws InterruptedException { | |
OperaDriver driver = new OperaDriver(); | |
driver.navigate().to("http://maps.google.com/?hl=en"); | |
System.out.println("Find the search box"); | |
OperaWebElement search = (OperaWebElement) driver.findElement(By.id("q_d")); | |
System.out.println("Type text and submit the form"); | |
search.sendKeys("Opera Software ASA, Oslo to Den Norske Opera & Ballett"); | |
driver.key("Enter"); | |
Thread.sleep(2000); | |
System.out.println("Select the first result"); | |
driver.findElement(By.id("ddw_dll_1_0")).click(); | |
Thread.sleep(2000); | |
System.out.println("Pan down"); | |
driver.findElement(By.xpath("//div[@log='pan_down']")).click(); | |
System.out.println("Zoom in"); | |
OperaWebElement zoomIn = (OperaWebElement) driver.findElement(By.xpath("//div[@title='Zoom In']")); | |
System.out.println(zoomIn.getTagName()); | |
System.out.println(zoomIn.getAttribute("style")); | |
zoomIn.click(10,10); | |
zoomIn.click(10,10); | |
System.out.println("Done!"); | |
Thread.sleep(10000); | |
driver.quit(); | |
} | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment