Getting hover text with selenium in java
- by BinaryEmpire
I am trying to figure out how to get the product availability text from a page like http://www.walmart.com/browse/TV-Video/TVs/_/N-96v3?
(once a store has been selected) I selected 76574 as my zipcode and went to the "In My Store" tab
The code I have now is
WebElement hoverElement = driver.findElement(By.xpath(".//*[@id='Body_15992428']/span"));
WebElement hidden = driver.findElement(By.xpath(".//*[@id='slapInfo_NoVariant_15992428']/div"));
Actions builder = new Actions(driver);
builder.clickAndHold(hoverElement).build().perform();
System.out.println(hidden.getText());
**Edit: I tried profile.setEnableNativeEvents(false); and the text is now displayed in the automated browser window. I still cannot get to the text I want though. It does not throw an exception, only displays nothing because the driver thinks its still hidden. Any one know how to fix this?
I keep getting
Exception in thread "main" org.openqa.selenium.InvalidElementStateException: Cannot perform native interaction: Could not load native events component.
Even after I do
profile.setEnableNativeEvents(true);
Are there any other ways I can get the hidden text, or what am I doing wrong here?
Additionally while I was inspecting the code with firebug, I saw that there is this code
<script type="text/javascript"> WALMART.$(document).ready(function(){ WALMART.$('#Body_15992428').hover(function(){ WALMART.$('#SeeStoreAvailBubble').wmBubble('update',WALMART.$('#bubbleMsgUpdate_15992428').html()); }); }); </script>
I dont really know how to do things directly with javascript but is there is any way of getting the message text directly from that with a javascript executor?