using Actions for html select box in selenium java -


i trying select item html select box using selenium phantomjs driver org.openqa.selenium.interactions.actions along taking screen shot see whether moves mouse cursor specified item in select box far tried below code no success: (i have placed comment on each block of actions below)

lblstatus.settext("selecting gender..."); wait.until(expectedconditions.presenceofelementlocated(by.xpath("//select[@name='gender']")));  //for moving mouse pointer on select box mouse.movetoelement(driver.findelement(by.xpath("//select[@name='gender']"))).perform();  //for performing click on select box, assuming here selectbox show dropdown items mouse.click(driver.findelement(by.xpath("//select[@name='gender']"))).perform();  //for moving mouse pointer on male option (but not yet clicked or selected) mouse.movetoelement(driver.findelement(by.xpath("//select[@name='gender']/option[@value='male']"))).perform();  //taking screen shot, assuming mouse pointer on male option try {        file scrfile = ((takesscreenshot) driver).getscreenshotas(outputtype.file);        fileutils.copyfile(scrfile, new file("selectbox.png")); } catch (ioexception ioe) {        system.err.println(ioe.getmessage()); } 

the above code works fine no error, when open selectbox.png not giving me trying get, expecting screnshot similar below image:

enter image description here

so possible achieve that? org.openqa.selenium.interactions.actions if yes, how achieve that, important want actions cause task achieve using actions class of org.openqa.selenium.interactions , requirement not screen shot using org.openqa.selenium.interactions.actions select item select box.

update:

i tried same firefoxdriver , found above code looking for, not able see mouse pointer movement on elements while sending keys , selecting right option selectbox, mean moving mouse pointer no 1 can see it, firefoxdriver opens new firefox window before doing phantomjs screenshots helps me see actual process phantomjs doing in case of firefoxdriver no screenshot needed able see live.

now question is:

is doing mouse movement on elements or not? or doing can't see it? please help.

user gestures "emulated", said in actions.class in selenium rc js, in selenium webdriver - more internal browser mechanism, clear both "element" , "keyboard/mouse" actions have same nature - see drivercommand , have nothing system mouse/keyboard.

you won't see mouse pointer anyway when doing screenshot.

in end unclear me why 1 use

mouse.movetoelement mouse.click mouse.movetoelement(option) 

instead of selectbyvisibletext on real html select.


Comments

Popular posts from this blog

python - No exponential form of the z-axis in matplotlib-3D-plots -

php - Best Light server (Linux + Web server + Database) for Raspberry Pi -

c# - "Newtonsoft.Json.JsonSerializationException unable to find constructor to use for types" error when deserializing class -