基于 SELENIUM 的自動化測試架構(14)

發表于:2017-04-11來源:gitbook作者:凌俁Linty?點擊數: 標簽:selenium
Select:針對 select 元素進行的操作 selectByValue(value) selectByIndex(index) // 找到該 select 元素 we WebElement we = driver.findElement(by, selector); // 使用該元素,實例化一個

Select:針對 <select>元素進行的操作

  • selectByValue(value)
  • selectByIndex(index)

    // 找到該 <select> 元素 we
    WebElement we = driver.findElement(by, selector);
    // 使用該元素,實例化一個 Select 類的對象 s
    Select s = new Select(we);
    s.selectByValue(value);
    // 或者用index
    s.selectByIndex(value)
    
  • 鼠標事件,有關鼠標的操作,不只是單擊,有時候還要做右擊、雙擊、拖動等操作。這些操作包含在ActionChains類中。

    • contextClick():右擊
    • douchClick():雙擊
    • dragAndDrop():拖拽
    • moveToElement():鼠標停在一個元素上
    • clickAndHold():按下鼠標左鍵在一個元素上
  • 原文轉自:http://gitbook.cn/books/58e54b57cfcd6fa52dcef1d2/index.html

  • ...
    国产97人人超碰caoprom_尤物国产在线一区手机播放_精品国产一区二区三_色天使久久综合给合久久97