一,表单元素定位顺序(建议)
• name优先
• id其次
• css selector(几乎可以定位所有元素)
• class+index
• xpath或其它
二,table(thead,tbody,tfoot)
tr代表行,th代表列,均可用find_element_by_xxx定位
三、富文本框赋值
富文本框是指<iframe></iframe>
- 首先访问iframe
- 再访问iframe中的contentWindow
- 再访问body
- 使用innerText属性进行赋值(innterHtml)
self.set_content('content content')
def set_content(self, text):
js = "document.getElementById('content_ifr').contentWindow.document.body.innerText = '%s'" %(text)
self.driver.execute_script(js)