EDIT: Not sure if it really helps to figure it out, but this is Sharepoint based.
I have an element with special character which the Webdriver can't locate.
var element = wait.Until(x => x.FindElement(By.Id("Tasrit_6aecdca9-e3b9-4141-ae36-d537784f9592_$TextField_inplacerte")));
element.SendKeys("foo");
I guess it is the $
that causes the problem.
On the contrary , I found it by using :
var element = wait.Until(x => x.FindElements(By.CssSelector("div[id*='Tasrit_6aecdca9-e3b9-4141-ae36-d537784f9592']")));
element[2].FindElement(By.TagName("p")).SendKeys("foo");
The test passes that way(seemingly), but the value isn't really being sent to the field.
Unfortunately, there is no input
tag on the element's hierarchy, and when inserting the text manually , I can then see that the value was inserted to the <p>
tag. But , as shown, when using the <p>
tag , it doesn't really help.
The HTML:
<div class="ms-rtestate-write ms-rteflags-0 ms-rtestate-field" id="Tasrit_6aecdca9-e3b9-4141-ae36-d537784f9592_$TextField_inplacerte" role="textbox" aria-haspopup="true" aria-labelledby="Tasrit_6aecdca9-e3b9-4141-ae36-d537784f9592_$TextField_inplacerte_label" style="min-height: 84px;" contenteditable="true" aria-autocomplete="both" aria-multiline="true" RteDirty="true">
<p>
<span id="ms-rterangecursor-start" RteNodeId="1"></span>
<span id="ms-rterangecursor-end"></span>
</p>
</div>