拿到输入框的内容

<textarea id="w1" class="form-control" placeholder="请输入地域词(必填)"/>

输入框中的内容,html中拿不到,可以通过执行jQuery来获取

    def js_getvalue(self, script):
        res = self.driver.execute_script(script)return res

 

def getinputTextbyId(self, id):
    """获取输入框中输入的值"""
    script = "return $('#{}').val();".format(id)
    input_value = self.driver.js_getvalue(script)
    return input_value

 

 

posted @ 2018-02-06 14:12  xiaojinniu425  阅读(156)  评论(0编辑  收藏  举报