zoukankan      html  css  js  c++  java
  • [Selenium] The commonly used operation of element

    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);

  • 相关阅读:
    Android开发新手学习总结(六)——android开发目录结构【图文版】
    Android开发新手学习总结(一)——使用Android Studio搭建Android集成开发环境
    62个Android Studio小技巧合集
    Android Studio 入门指南
    Unity操作
    Unity的安装和破解
    pb数据窗口设置操作
    Roll A Ball
    c实现旋转数列
    用循环添加多行、多列视图
  • 原文地址:https://www.cnblogs.com/feifeidxl/p/4450535.html
Copyright © 2011-2022 走看看