selenium - Cannot find a element on webpage as it loads javascript based error & hidden after few seconds (Registration form) -
im filling registration form. after filling fields click on register message hidden initially. i'm trying since long locate particular element.
but i'm not able locate element due particular error never caught , cannot proceed.
need input guys. i've tried isdisplayed(), isenabled() etc. none of them work. i've worked on writing custom methods handle isn't able handle.
//iselementpresent custom method written me //appointment.phonenomatch locator i've stored in objectrepository boolean phoneerror = iselementpresent(appointment.phonenomatch); if (phoneerror==true) { system.out.println("phone no exist"); break; } else { //rest of execution } public boolean iselementpresent(by by) throws throwable { try { list<webelement> ele = driver.findelements(by); if (ele.size() > 0) { return true; } else { return false; } } catch (exception e) { system.out.println(e.getmessage()); return false; } }
it's created browser because field has html 5 required
property set, , isn't html / dom element can detect in usual way. however, see answer: https://stackoverflow.com/a/29548873/954442 how detect using css pseudo-selector.
if it's causing problems test, 1 suggestion remove property using javascript , fall testing server side's validation, e.g. http error code.
see also: chrome popup please fill out field , check if "please enter email address" message appears
Comments
Post a Comment