zoukankan      html  css  js  c++  java
  • Auto-Test 要点纪录(一)

    1,select下拉框类型

    使用工具可以看到html对应标签为<select>这类标签才是真正的下拉框类型就需要对应的方法,不能但看页面上的效果,有的做成了效果但其实不是select类型即不能使用select相应方法

    Select selectState = new Select(driver.findElement(By
                        .id("billing_state_id")));
                selectState.selectByValue("12");

    2,刷新页面

    String script = "document.location.reload()";
                ((JavascriptExecutor) driver).executeScript(script);

    3,截获文本内容,多见于提示信息显示速即被hide效果

                WebElement hiddenDiv = driver.findElement(By.id("notice"));
                String script = "return document.getElementById('notice').innerHTML";
                String currentText = (String) ((JavascriptExecutor) driver)
                        .executeScript(script, hiddenDiv);
                log.info("the text is " + currentText);

    4,在查找元素时遵循的原则是如果元素的id或者class唯一显著那么可以直接访问id或者class而不要执迷于css或者xpath这样往往查找耗时而且容易找不到

  • 相关阅读:
    js中的异常处理
    CSS3之box-sizing属性
    AJAX
    NaN与Null与undefiined的关系
    跳转语句之continue与break
    npm火速上手
    程序里面的‘脑筋急转弯’
    css伪元素::before与::after
    常用正则表达式、JS中的正则以及ES6的扩展
    git
  • 原文地址:https://www.cnblogs.com/lisa090818/p/3183653.html
Copyright © 2011-2022 走看看