[Selenium] The commonly used operation of element
2015-04-23 14:50
399 查看
btnLogin.click(); //Click element
SeleniumUtil.jsClick(driver, saveButtonEl); //If click() is not applicable ,try this one
txtEmail.clear(); //Clear text box before send keys to it
txtEmail.sendKeys(“jenny.zhang@morningstar.com”); //Send keys to text box
emailEl.getAttribute("title"); //Get attribute value of element
hoverEl.getText(); //Get text of element
SeleniumUtil.scrollIntoView(driver, el); //Scroll the element into view if the function needs scroll bar or mouse wheel when manual testing
//Click a hidden element
action.moveToElement(pencilIcon).click();
//Before click an element under a hidden element
locx=(theRow.getSize().width)/100;
locy=(theRow.getSize().height)/2;
action.moveToElement(theRow, locx, locy);
//Get text of hidden element
String dataPointName = (String) ((JavascriptExecutor) driver).executeScript(
"return jQuery(arguments[0]).text();", element);
//Ctrl+click
Actions a = new Actions(driver);
a.keyDown(Keys.CONTROL).perform();
for(int i = 0;i<quantity;i++){
WebElement securityEl = securitiesList.get(i);
SeleniumUtil.scrollIntoView(driver, securityEl);
securityEl.click();
}
a.keyUp(Keys.CONTROL).perform();
//Drag and drop
Point targetWidgetPos = targetWidgetEl.getLocation();
Point widgetPos = widgetEl.getLocation();
int offsetX = targetWidgetPos.getX() - widgetPos.getX();
int offsetY = targetWidgetPos.getY() - widgetPos.getY();
SeleniumUtil.dragAndDropOffset(driver, titleEl, offsetX, offsetY);
SeleniumUtil.jsClick(driver, saveButtonEl); //If click() is not applicable ,try this one
txtEmail.clear(); //Clear text box before send keys to it
txtEmail.sendKeys(“jenny.zhang@morningstar.com”); //Send keys to text box
emailEl.getAttribute("title"); //Get attribute value of element
hoverEl.getText(); //Get text of element
SeleniumUtil.scrollIntoView(driver, el); //Scroll the element into view if the function needs scroll bar or mouse wheel when manual testing
//Click a hidden element
action.moveToElement(pencilIcon).click();
//Before click an element under a hidden element
locx=(theRow.getSize().width)/100;
locy=(theRow.getSize().height)/2;
action.moveToElement(theRow, locx, locy);
//Get text of hidden element
String dataPointName = (String) ((JavascriptExecutor) driver).executeScript(
"return jQuery(arguments[0]).text();", element);
//Ctrl+click
Actions a = new Actions(driver);
a.keyDown(Keys.CONTROL).perform();
for(int i = 0;i<quantity;i++){
WebElement securityEl = securitiesList.get(i);
SeleniumUtil.scrollIntoView(driver, securityEl);
securityEl.click();
}
a.keyUp(Keys.CONTROL).perform();
//Drag and drop
Point targetWidgetPos = targetWidgetEl.getLocation();
Point widgetPos = widgetEl.getLocation();
int offsetX = targetWidgetPos.getX() - widgetPos.getX();
int offsetY = targetWidgetPos.getY() - widgetPos.getY();
SeleniumUtil.dragAndDropOffset(driver, titleEl, offsetX, offsetY);
相关文章推荐
- sort operation used more than the maximum 33554432 bytes of RAM. Add an index,or specify a smaller
- 遇到错误----Mongodb----导出数据报错 Sort operation used more than the maximum 33554432 bytes of RAM
- The Introduction of Commonly Used Crushing Machinery
- mongo添加索引以及解决Sort operation used more than the maximum 33554432 bytes of RAM
- Mongodb: Sort operation used more than the maximum 33554432 bytes of RAM
- [Selenium] The most commonly used CSSSelector
- Some of the most commonly used libraries for application development
- [Selenium] The commonly used validation method
- .NET错误The 'targetFramework' attribute in the <compilation> element of the Web.config file is used only to target version 4.0 and later of the .NET Framework
- Commonly Used Elements of the DATE Format Mask
- pymongo.errors:Sort operation used more than the maximum 33554432 bytes of RAM. Add an index,
- Selenium Webdriver : Element not found in the cache - perhaps the page has changed since it
- log4j.xml警告log4j:WARN The content of element type "log4j:configuration" must match "(renderer*,appen
- Timeout expired , The timeout period elapsed prior to completion of the operation or the server
- ibatis:The content of element type "sqlMap" must match
- In C++, which of the following syntax can be used for instantiating an object named arr of the vecto
- 【原创】mybatis配置文件报错:The content of element type "configuration" must match "(properties>settings>typeAliases>typeHa...
- The content of element type "mapper" must match "(cache-ref|cache|resultMap*|parameterMap*|sql*| ins
- System.InvalidOperationException: Operation is not valid due to the current state of the object.
- dubbo实战---lineNumber: 13;columnNumber: 82; cvc-elt.1: Cannot find the declaration of element 'beans'