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

  • 相关阅读:
    MYSQL[18]
    MYSQL[11]
    hdu 1847
    hdu 2149
    uva 10341
    hdu 1850
    uva 10391字典树
    hdu 2473
    uva 10761
    hdu 1198
  • 原文地址:https://www.cnblogs.com/feifeidxl/p/4450535.html
Copyright © 2011-2022 走看看