gpt4 book ai didi

javascript - Protractor 从 iframe 切换到默认内容

转载 作者:行者123 更新时间:2023-11-30 15:28:11 25 4
gpt4 key购买 nike

我正在尝试最小化 iframe 表单并发布我想在我的普通页面上开始工作的信息。但是,当我尝试切换到默认内容时,浏览器会重定向到原始页面,例如:data。

browser.switchTo().frame(iframeLiveChat).then(function(){
console.log("我进入了框架");
driver.findElement(by.xpath(".//*[@id='title']")).click().then(function(){
console.log("我点击了按钮");
browser.switchTo().defaultContent();
//在这一行之后,浏览器将自身重定向到 :data 页面而不是其中的 url。
});
});
无法切换回默认内容。

最佳答案

您是否尝试过不将开关切换到回调?

browser.switchTo().frame(iframeLiveChat).then(()=> console.log("i have entered frame"))
element(by.xpath(".//*[@id='title']")).click().then(()=> console.log("i have clicked button"))
browser.switchTo().defaultContent();

关于javascript - Protractor 从 iframe 切换到默认内容,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/42642048/

25 4 0
Copyright 2021 - 2024 cfsdn All Rights Reserved 蜀ICP备2022000587号
广告合作:1813099741@qq.com 6ren.com