java - Unable to find elements in modal popup using selenium -
this question has answer here:
- what nullpointerexception, , how fix it? 12 answers
i need confirm modal popup. have form fill , have move next page. when click continue, modal popup appears asking if details filled correct?
there 2 button , other description on it. 1 button reads cancel , other says yes, information correct.
tried switching modal element
driver.switchto().frame(0); // there 1 popup
however, whatever webdriver
after results in nullpointerexception
no webelement found.
this trying
webelement modalbuttoncontainer = autoutils.findelementbyclassname(modaloverlay, "modalbuttoncontainer"); webelement modalbutton = autoutils.findelementbyclassname(modalbuttoncontainer, "buttonclass"); modalbutton.click();
but results in nullpointer
. how click modalbutton
?
if recall correctly driver.switchto().frame(0);
switches <iframe>
elements. here you're talking popup
. 1 again depends, if typical javascript
popup invoked javascript:alert('popup')
or similar,
alert alert = driver.switchto().alert(); alert.accept();
is way go. otherwise, if it's bootstrap popup, don't need switching @ all, maybe fluentwait
only.
(if doesn't work, please share dom)
wiki
Comments
Post a Comment