You can use WebDriverWait see - http://stackoverflow.com/questions/7991522/selenium-webdriver-test-if-element-is-present
Thanks, Krishantha. On Tue, Feb 9, 2016 at 3:01 PM, Lahiru J Ekanayake <lahi...@wso2.com> wrote: > Hi , > > I'm writing selenium tests for GREG publisher UI. When implementing UI > test cases, some situations we need to check whether some elements exists, > before click or make any operations on them. > Selenium provides, *driver.findElement(By.id("elemnt_id")) * > method to find any element by id. Problem is if that element is not exist > , it will return an error, saying > *org.openqa.selenium.NoSuchElementException: Unable to locate > element:{"method":"id","selector":"elemnt_id"}* > > Is there any way to check the existence of any element , without catching > the error? . > > > > > Regards > > > > -- > > > > *Lahiru J Ekanayake**Software Engineer* > Mobile : +94 (0) 77 8812629 / +94(0) 778509547 > Email : lahi...@wso2.com > WSO2, Inc.; http://wso2.com/ > lean . enterprise . middleware. > > -- Krishantha Samaraweera Senior Technical Lead - Test Automation Mobile: +94 77 7759918 WSO2, Inc.; http://wso2.com/ lean . enterprise . middleware.
_______________________________________________ Dev mailing list Dev@wso2.org http://wso2.org/cgi-bin/mailman/listinfo/dev