Selenium RC DragAndDrop
来源:互联网 发布:mac os 无法更新 编辑:程序博客网 时间:2024/06/01 21:32
(1) dragAndDrop - Locates the target element and drags the element by x pixels horizontally and y pixels vertically.
In the IDE this should look like;
Command - dragAndDrop
Target - [ locator of the target element ]
Value - [ (x-pixels),(y-pixels) ]
(2) dragAndDropToObject - Locates the target element and drags the element to the centre pixel location of the destination element
In the IDE this should look like;
Command - dragAndDropToObject Target - [ locator of the target element ] Value - [ locator of the destination element you want to drop it on top of ]
(3) Use MouseDownAt, MouseMoveAt, MouseUpAt to resolve drag and drop.
In the IDE this should look like;
Command - dragAndDrop
Target - [ locator of the target element ]
Value - [ (x-pixels),(y-pixels) ]
- where x-pixels/y-pixels can be negative (left/up respectively) or positive (right/down respectively)
- string dragLocator = @"//a[@id=abc]";
- string dropLocator = @"//td[text()='drop to here']";
- decimal dropX = selenium.GetElementPositionLeft(dropLocator);
- decimal dropY = selenium.GetElementPositionTop(dropLocator);
- decimal endX = selenium.GetElementWidth(dropLocator);
- decimal endY = selenium.GetElementHeight(dropLocator);
- endX = Math.Round(dropX + (endX / 2));
- endY = Math.Round(dropY + (endY / 2));
- String movementsString = "" + endX + "," + endY;
- selenium.DragAndDrop(dragLocator, movementsString);
string dragLocator = @"//a[@id=abc]"; string dropLocator = @"//td[text()='drop to here']";decimal dropX = selenium.GetElementPositionLeft(dropLocator);decimal dropY = selenium.GetElementPositionTop(dropLocator);decimal endX = selenium.GetElementWidth(dropLocator);decimal endY = selenium.GetElementHeight(dropLocator);endX = Math.Round(dropX + (endX / 2));endY = Math.Round(dropY + (endY / 2));String movementsString = "" + endX + "," + endY;selenium.DragAndDrop(dragLocator, movementsString);
(2) dragAndDropToObject - Locates the target element and drags the element to the centre pixel location of the destination element
In the IDE this should look like;
Command - dragAndDropToObject Target - [ locator of the target element ] Value - [ locator of the destination element you want to drop it on top of ]
- string dragLocator = @"//a[@id=abc]";
- string dropLocator = @"//td[text()='drop to here']";
- Selenium.DragAndDropToObject(dragLocator, dropLocator);
string dragLocator = @"//a[@id=abc]"; string dropLocator = @"//td[text()='drop to here']"; Selenium.DragAndDropToObject(dragLocator, dropLocator);
(3) Use MouseDownAt, MouseMoveAt, MouseUpAt to resolve drag and drop.
- string dragLocator = @"//a[@id=abc]";
- string dropLocator = @"//td[text()='drop to here']";
- selenium.MouseMove(dragLocator);
- Thread.Sleep(3000);
- selenium.MouseDownAt(dragLocator, "0,0");
- Thread.Sleep(3000);
- selenium.MouseMoveAt(dropLocator, "0,0");
- Thread.Sleep(3000);
- selenium.MouseUpAt(dropLocator, "0,0");
- Thread.Sleep(3000);
string dragLocator = @"//a[@id=abc]"; string dropLocator = @"//td[text()='drop to here']"; selenium.MouseMove(dragLocator); Thread.Sleep(3000); selenium.MouseDownAt(dragLocator, "0,0"); Thread.Sleep(3000); selenium.MouseMoveAt(dropLocator, "0,0"); Thread.Sleep(3000); selenium.MouseUpAt(dropLocator, "0,0"); Thread.Sleep(3000);
0 0
- Selenium RC DragAndDrop
- Selenium RC DragAndDrop
- Selenium RC
- 认识Selenium ---selenium RC简介
- Selenium学习-selenium RC简介
- 认识Selenium ---selenium RC简介
- selenium IDE+selenium RC+Firefox
- Selenium-RC:应用指南
- selenium RC 的使用
- 結合 Selenium RC
- selenium RC 环境配置
- selenium RC 环境配置
- selenium rc 遇到问题
- selenium RC环境搭建
- 如何使用Selenium-RC
- Selenium RC 打开浏览器
- Selenium RC(7)
- selenium RC 环境配置
- Selenium2.0 Webdriver - Element can be click when out of view
- 使用 UIBezierPath+CAShapeLayer 实现不在View层绘制自定义图形
- 共用体
- Selenium RC keypress
- 关于SSH框架设计的一些理解
- Selenium RC DragAndDrop
- DBA_Oracle基本体系内存和进程结构(概念)
- Linux内核剖析 之 回收页框
- 关于数据库索引-1
- 最值得学习阅读的10个C语言开源项目代码
- 20 个整数的和
- Ubuntu下安装配置 PPTP
- hibernate简介
- JMeter入门1---安装