Warning: file_get_contents(/data/phpspider/zhask/data//catemap/8/selenium/4.json): failed to open stream: No such file or directory in /data/phpspider/zhask/libs/function.php on line 167

Warning: Invalid argument supplied for foreach() in /data/phpspider/zhask/libs/tag.function.php on line 1116

Notice: Undefined index: in /data/phpspider/zhask/libs/function.php on line 180

Warning: array_chunk() expects parameter 1 to be array, null given in /data/phpspider/zhask/libs/function.php on line 181
Can';在IE8中显示的contenteditable div中键入selenium_Selenium_Selenium Rc - Fatal编程技术网

Can';在IE8中显示的contenteditable div中键入selenium

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

在IE8浏览器中使用selenium 1自动化Sharepoint站点时,我遇到了以下问题。我无法键入标记(Sharepoint人员选取器字段) 以下是html代码:

 <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

您使用的定位器类型是什么?Xpath或CSS?我尝试了这两种类型,但都没有成功。澄清一下:Selenium通过使用CSS和Xpath定位器成功地找到了textarea和div标记,但是文本不会出现在字段中。您确定这不是页面加载问题吗?就像在页面完全加载之前输入文本一样,当页面加载时,可能会将文本区域重置为空?你也可以把你试过的定位器放进去吗?我几乎可以肯定这不是加载页面的问题——我也使用了time break和ajax wait。下面是我使用的选择器:sel.type(“css=div[id$=”\u pepepeopleeditor\u upLevelDiv'],“Test”)sel.type(“css=textarea[id$='pepepepeopleeditor\u downlevelditbox'],“Test”)sel.type(//div[contains(@id,'pepepepeopleeditor\u downlevelditbox')),“Test”)sel.type(//div[contains(@id,'pepepepeopleeditor'u downlevelditor'),“Test”),“Test”)
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)