File upload works during debugging but not on the actual run in c# -
while debugging, below code works. when trial run of test displays error. combat error, i've added java script ( example question) change opacity, doesn't seem trick.
upload part of code:
//file details filename = "emed.pdf"; filepath = "\\\\iasfs1\\qa\\openspace\\automation\\filesforupload\\emed.pdf"; //file upload waitforelementpresent(by.id("upload")); ijavascriptexecutor js = (ijavascriptexecutor)driver; js.executescript("document.getelementbyid('fileupload').style.opacity = 1;");'' iwebelement fileupload = driver.findelement(by.id("fileupload")); console.write("fileupload.displayed : " + fileupload.displayed.tostring()); debug.writeline("fileupload.displayed : " + fileupload.displayed.tostring()); system.diagnostics.trace.writeline("fileupload.displayed : " + fileupload.displayed.tostring()); fileupload.sendkeys(osdata.filepath);'
error displayed message: openqa.selenium.elemenynotvisibleexception : element not visible , may not interacted with.
any on above appreciated
thank in advance
you said works on debugging, not on full run through?
99% of times happens, because of waiting issue.
you waiting element present not waiting visible, explains error (notvisibleexception). try waiting element visible.
Comments
Post a Comment