I'm having an issue with InternetExplorerDriver in Selenium WebDriver. The image below shows part of a Sharepoint site, with Audience Area and Location as fields which can either accept a manually typed input or a choice from a popup list on clicking the button at the far right of the field. In the example below, I have manually input an invalid entry in Audience Area and a valid entry in Location.
However, when running scripts in Selenium, the sendKeys command does not work on these elements. According to the xpath, these elements are identified as divs with the following properties:
<div id="AudienceArea_$containereditableRegion"
class="ms-rtestate-write ms-taxonomy-writeableregion ms-inputBox ms-inputBoxActive"
contenteditable="true"
role="textbox"
aria-autocomplete="both"
aria-haspopup="true"
aria-multiline="true"
disableribboncommands="True"
allowmultilines="false"
restrictpastetotext="True"
rtedirty="false">
The most recent attempt to code sending text to the element is as below:
Webelement element = driver.findElement(By.xpath("//html/body/form/div[4]/div/div[1]/div/div[2]/div[2]/div[2]/table/tbody/tr/td/div/div/div/div/table/tbody/tr/td[1]/span/table[1]/tbody/tr[5]/td[2]/div/div[1]/div/div"));
Actions actions = new Actions(driver);
actions.moveToElement(element);
actions.click();
actions.sendKeys("SomeText");
actions.build().perform();
When I run this in Firefox it identifies the element and sends the required text. When I attempt this in Internet Explorer, it successfully identifies the element and performs sendKeys, but nothing appears in the text field. No exception is returned.
Has anyone encountered anything like this before? Is there a way around this, such as an alternative to sendKeys?
I am running InternetExplorerDriver v2.53.1.0 with IE v11
I should add that I have also tried using JavascriptExecutor as follows: