java - Selenium getText() not working on htmlunitdriver -


i looked around , couldn't find specific answer helped me figure out what's happening in code.

i'm running selenium webdriver test using htmlunitdriver . i'm uploading picture on photobucket learning purposes. i've used firefoxdriver , worked fine. tried use htmlunitdriver , ide says code working (i changed firefoxdriver htmlunitdriver) whenever check picture album don't see picture. first guess headless browser not waiting picture upload , leaves, added ugly sleeps check onto , still doesn't work!

here's code

driver.get("http://s394.photobucket.com/upload/links");     thread.sleep(3000);     driver.findelement(by.id("urlinput")).sendkeys("photo_link");     driver.findelement(by.id("uploadbtn")).click();     thread.sleep(3000);     string text = driver.findelement(by.classname("progresscount")).gettext();     driver.findelement(by.id("goalbum")).click();     driver.close(); 

the gettext() used on html element looks this.

<div class="progresscount" style="width: 711px;">100%</div> 

it's loading bar. point make webdriver web wait until bar announces full proceed , close driver.

whenever try use gettext, intellij throws series of warnings , errors defaultcsserrorhandler related "style rule" though , string remains empty.

you can try following :

driver.findelement(by.cssselector("div.progresscount")).gettext();


Comments

Popular posts from this blog

python - TypeError: start must be a integer -

c# - DevExpress RepositoryItemComboBox BackColor property ignored -

django - Creating multiple model instances in DRF3 -