如何访问selenium中返回的JavaScript承诺值?
我试图访问从JavaScript函数返回的承诺值。当我尝试在selenium中返回它时,它不返回任何值。我的功能正常,可以在console.log中打印responseData。我只是很难用python访问它。有什么办法吗如何访问selenium中返回的JavaScript承诺值?,javascript,python,selenium,Javascript,Python,Selenium,我试图访问从JavaScript函数返回的承诺值。当我尝试在selenium中返回它时,它不返回任何值。我的功能正常,可以在console.log中打印responseData。我只是很难用python访问它。有什么办法吗 js_value = self.driver.execute_script(""" var request = ""; async function final(){ await send("POST", "https:/
js_value = self.driver.execute_script("""
var request = "";
async function final(){
await send("POST", "https://www.thecrims.com/login",data).then((responseData)=>{
request = responseData
});
};
return request;
""")
time.sleep(3)
print(js_value)
应
返回请求代码>进入js,我的意思是在结束之前“
?@supputuri comiplation Error,我的错。已经编辑。应该返回请求;
进入js,我的意思是在结束之前”
?@supputuri comiplation Error,我的错。已经编辑过了。