isElementPresent in selenium 2.0

前端 未结 6 1422
太阳男子
太阳男子 2021-02-19 11:09

Hello all I am using webdriver so if I want to use selenium;s rc function isElementPresent I have to emulate selenium rc so I do something like this:

import org.         


        
6条回答
  •  不思量自难忘°
    2021-02-19 11:36

    I'm using the Node library selenium-webdriver 3.6.0.

    It has driver.findElements (return zero or more items) and driver.findElement (returns first item found or throw NoSuchElementError).

    So I'd like to recommend this as a check for if at least one element can be found. Perhaps useful in Java.

    driver.findElement(By.className("someclass"));
    

提交回复
热议问题