Can';在IE8中显示的contenteditable div中键入selenium
在IE8浏览器中使用selenium 1自动化Sharepoint站点时,我遇到了以下问题。我无法键入标记(Sharepoint人员选取器字段) 以下是html代码:Can';在IE8中显示的contenteditable div中键入selenium,selenium,selenium-rc,Selenium,Selenium Rc,在IE8浏览器中使用selenium 1自动化Sharepoint站点时,我遇到了以下问题。我无法键入标记(Sharepoint人员选取器字段) 以下是html代码: <td sizcache="10" sizset="0"> <div tabIndex="0" title="People Picker" class="ms-inputuserfield" i
<td sizcache="10" sizset="0">
<div tabIndex="0"
title="People Picker"
class="ms-inputuserfield"
id="ctl00_ctl00_pePeopleEditor_upLevelDiv"
style="overflow-x: hidden; overflow-y: auto; background-color:window; width: 100%; height: 18px; color: windowtext;"
contentEditable="true"
onkeydown="return onKeyDownRw(this, 'ctl00_ctl00_pePeopleEditor',3, true, event);"
onkeyup="return onKeyUpRw('ctl00_ctl00_pePeopleEditor');"
onclick="onClickRw(true, true);"
onblur="updateControlValue('ctl00_ctl00_pePeopleEditor')"
ondragstart="canEvt(event);"
oncopy="docopy();"
onpaste="dopaste();"
onfocusin="this._fFocus=1;saveOldEntities('ctl00_ctl00_pePeopleEditor_upLevelDiv')"
onfocusout="this._fFocus=0;"
name="upLevelDiv"
AutoPostBack="0"
onChange="updateControlValue('ctl00_ctl00_pePeopleEditor')"
/>
<textarea
name="ctl$ctl00$pePeopleEditor$downlevelTextBox"
title="People Picker"
class="ms-input" id="ctl00_ctl00_pePeopleEditor_downlevelTextBox"
style="position: absolute; width: 100%; display: none; height:20px;"
onkeydown="return onKeyDownRw(this, 'ctl00_ctl00_pePeopleEditor', 3,true, event);"
onkeyup="onKeyUpRw('ctl00_ctl00_pePeopleEditor');"
rows="1"
cols="20"
AutoPostBack="0"
/>
</td>
还请注意,FF和IE6上的此字段没有问题
有人知道如何处理此Sharepoint人员选择器字段吗
Alek我没有找到解决问题的方法,但这似乎是硒1的一个限制 据了解,克服这个问题的一种方法是使用硒2。事实上,我可以用Selenium 2在IE8上输入这个字段。 David还指出了克服contenteditable设置为true的标记问题的方法: 我已经开始移动我的Internet Explorer Selenium测试,以使用WebDriver API测试我们站点的编辑器组件。这是Selenium 1最难自动化的领域之一,因为它在div上使用contentEditable。我设法使用组件JavaScript API注入HTML并对其进行操作,然后使用API再次取出HTML并检查其是否正确 总而言之,我可以:
- 使用Webdriver切换到Selenium 2
- 使用JavaScript API组件 注入原始HTML
self.selenium.click(div_locator)
self.selenium.type_keys(div_locator, "string")
self.selenium.key_press(div_locator, "string")
self.selenium.key_press_native(65)
------------------------------------------------------------------------------------
self.selenium.fire_event(div_locator,"focus")
self.selenium.type_keys(div_locator, "string")
self.selenium.key_press(div_locator, "string")
self.selenium.key_press_native(65)
----------------------------------------------------------------------------------
self.selenium.click_at(div_locator,"")
self.selenium.type_keys(div_locator, "string")
self.selenium.key_press(div_locator, "string")
self.selenium.key_press_native(65)
------------------------------------------------------------------------------------
self.selenium.click(textbox_locator)
self.selenium.type(textbox_locator, "string")
self.selenium.type_keys(textbox_locator, "string")
self.selenium.key_press(textbox_locator, "string")
self.selenium.key_press_native(65)
------------------------------------------------------------------------------------
self.selenium.fire_event(textbox_locator,"focus")
self.selenium.type(textbox_locator, "string")
self.selenium.type_keys(textbox_locator, "string")
self.selenium.key_press(textbox_locator, "string")
self.selenium.key_press_native(65
----------------------------------------------------------------------------------
self.selenium.set_cursor_position(textbox,-1)
self.selenium.key_press(textbox_locator, "\\13")
self.selenium.key_press_native(10)
self.selenium.key_press_native(65)