selenium WebDriver 操作高德地图
String URL="http://www.amap.com/";
WebDriver driver = new FirefoxDriver(profile);
driver.get(URL);
driver.manage().window().maximize();
driver.manage().timeouts().implicitlyWait(60, TimeUnit.SECONDS);
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
WebElement chooseCityElement=driver.findElement(By.xpath("//div/span[@class='icon_expand cursor ml5']"));
chooseCityElement.click();
WebElement city_iframe=driver.findElement(By.xpath("//iframe[@id='city_iframe']"));
driver.switchTo().frame(city_iframe);
WebElement BJ=driver.findElement(By.xpath("//div/a[text()='北京']"));
BJ.click();
driver.switchTo().defaultContent();
WebElement inputBoxElement=driver.findElement(By.xpath("//input[@id='keywordTxt']"));
WebElement searchButton=driver.findElement(By.xpath("//input[starts-with(@class,'magnifier_button')]"));
inputBoxElement.clear();
inputBoxElement.sendKeys("天安门");
searchButton.submit();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
WebElement tiAnMenElement=driver.findElement(By.xpath("//div[@title='天安门']"));
tiAnMenElement.click();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS); WebElement comeToHereElement=driver.findElement(By.xpath("//div[@class='route']//li[text()='到这里去']"));
comeToHereElement.click(); WebElement setStartLocationElement =driver.findElement(By.xpath("//div/input[@class='route-input srh-ipt']"));
setStartLocationElement.sendKeys("火车站");
WebElement routeByBus=driver.findElement(By.xpath("//div[@id='rout-by-bus']"));
routeByBus.click();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS);
WebElement startFrom=driver.findElement(By.xpath("//div[@class='start_end_item_title' and contains(text(),'北京站')]"));
Actions actions= new Actions(driver);
actions.moveToElement(startFrom).click(driver.findElement(By.xpath("//a[contains(text(),'设为起点') and @data-name='北京站']"))).perform();
driver.manage().timeouts().pageLoadTimeout(30, TimeUnit.SECONDS); driver.findElement(By.xpath("//div[@class='amap-zoom-plus']")).click();
selenium WebDriver 操作高德地图的更多相关文章
- selenium 配合sikuli script操作高德地图
会不会使用工具,是一般QA和高级QA的区别 ---To be crazy Java就是好,开源框架遍地都是,各种niubility的jar包,各种神器,真是不亦乐乎. 今天研究一下基于图片识别作为对象 ...
- Selenium Webdriver——操作隐藏的元素(二)display属性
有时候我们会碰到一些元素不可见,这个时候selenium就无法对这些元素进行操作了.例如,下面的情况: 页面主要通过“display:none”来控制整个下拉框不可见.这个时候如果直接操作这个下拉框, ...
- Selenium Webdriver——操作隐藏的元素(三)switchTo().frame()
在web 应用中经常会遇到frame 嵌套页面的应用,页WebDriver 每次只能在一个页面上识别元素,对于frame 嵌套内的页面上的元素,直接定位是定位是定位不到的.这个时候就需要通过switc ...
- Selenium Webdriver——操作隐藏的元素
有时候我们会碰到一些元素不可见,这个时候selenium就无法对这些元素进行操作了.例如,下面的情况: 页面主要通过“display:none”来控制整个下拉框不可见.这个时候如果直接操作这个下拉框, ...
- selenium webdriver操作各浏览器
描述 本文主要是针对Chrome 62 , firefox57 ,和IE11 三个版本的操作.相关的driver .可点击以下链接.所有的driver 建议放在浏览器的目录下,本文中所有的driver ...
- Selenium Webdriver——操作隐藏的元素display属性
有时候我们会碰到一些元素不可见,这个时候selenium就无法对这些元素进行操作了.例如,下面的情况: 页面主要通过“display:none”来控制整个下拉框不可见.这个时候如果直接操作这个下拉框, ...
- Selenium webdriver 操作日历控件
一般的日期控件都是input标签下弹出来的,如果使用webdriver 去设置日期, 1. 定位到该input 2. 使用sendKeys 方法 比如: 但是,有的日期控件是readonly的 比如1 ...
- Selenium webdriver 操作chrome 浏览器
Step1: 下载chromedriver. 下载路径: http://chromedriver.storage.googleapis.com/index.html 选择一个合适的下载即可.我下载的是 ...
- Selenium webdriver 操作IE浏览器
V1.0版本:直接新建WebDriver使用 import org.openqa.selenium.WebDriver; import org.openqa.selenium.ie.InternetE ...
随机推荐
- CF460B Little Dima and Equation (水题?
Codeforces Round #262 (Div. 2) B B - Little Dima and Equation B. Little Dima and Equation time limit ...
- poj2391 Ombrophobic Bovines 题解
http://poj.org/problem?id=2391 floyd+网络流+二分 题意:有一个有向图,里面每个点有ai头牛,快下雨了牛要躲进雨棚里,每个点有bi个雨棚,每个雨棚只能躲1头牛.牛可 ...
- lwfs指定特定目录输出
在特定节点启lwfs服务,输出特定的目录 在[root@devcpucs ~]# 节点启lwfs服务,输出指定目录/home/export/online1/systest/swcpucs 1.将gio ...
- HDOJ 4750 Count The Pairs
按边长从小到大排序...再逐个加入(就像MST一样)最先联通的点之间最长路径中的最小值就是新加入的边的长.... Count The Pairs Time Limit: 20000/10000 MS ...
- maven之ubutu安装
1.下载地址:http://maven.apache.org/download.cgi 2.安装 将下载后的文件解压到你指定的文件即可,命令如下: tar -xzvf apache-maven-3.0 ...
- data_quick 进度
20131118 加入xml对L8卫星波段控制: 纠正波段顺序 QVProc20131125.7z: 完成L8的增强 以后的程序会添加ZY3号解析模块 QVProc20131126.7z: 新增 粗 ...
- jquery左右滑动效果的实现
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/ ...
- 给groupBox添加滚动条
public Form3() { InitializeComponent(); foreach (Control gbox in groupBox1.Controls) { if (gbox is V ...
- Xcode 6制作动态及静态Framework和各种坑
Xcode 6制作动态及静态Framework http://www.cocoachina.com/ios/20141126/10322.html 有没有写SDK或者要将一些常用的工具类做成Frame ...
- Markdown入门教程
Markdown 是一种轻量级的「标记语言」,它的优点很多,目前也被越来越多的写作爱好者,撰稿者广泛使用.看到这里请不要被「标记」.「语言」所迷惑,Markdown 的语法十分简单.常用的标记符号也不 ...