java - What are these extra methods in the Selenium Webdriver code? -
so record steps of website using selenium ide , export using java /junit 4 / webdriver . , open in eclipse , find 4 methods in code. don't understand purpose of methods, don't deal alert windows or finding element. here methods
@after public void teardown() throws exception { driver.quit(); string verificationerrorstring = verificationerrors.tostring(); if (!"".equals(verificationerrorstring)) { fail(verificationerrorstring); } } private boolean iselementpresent(by by) { try { driver.findelement(by); return true; } catch (nosuchelementexception e) { return false; } } private boolean isalertpresent() { try { driver.switchto().alert(); return true; } catch (noalertpresentexception e) { return false; } } private string closealertandgetitstext() { try { alert alert = driver.switchto().alert(); string alerttext = alert.gettext(); if (acceptnextalert) { alert.accept(); } else { alert.dismiss(); } return alerttext; } { acceptnextalert = true; }
the last 3 methods quit easy understand does, please tell me teardown() does. ok can remove these functions , keep required part.
you want keep setup()
, teardown()
methods. setup()
method used start browser session before running test, , teardown()
used cleanly exit when test has completed.
Comments
Post a Comment