- html - 出于某种原因,IE8 对我的 Sass 文件中继承的 html5 CSS 不友好?
- JMeter 在响应断言中使用 span 标签的问题
- html - 在 :hover and :active? 上具有不同效果的 CSS 动画
- html - 相对于居中的 html 内容固定的 CSS 重复背景?
我想用 pybot
运行测试,然后使用 pybot
运行更多测试使用与第一个 pybot
相同的浏览器窗口打开。
所以…
pybot test1.txt
#opens browser window and runs test1.txt and doesn't close the window
#pybot completes execution
pybot test2.txt
#uses the same browser window from test1
#pybot completes execution
pybot test3.txt
#uses the same browser window from test1
#pybot completes execution
Open Browser www.mysite.com alias=1
在第一个测试然后
Switch Browser 1
在其他人中,但他们只是错误
No browser is open
最佳答案
selenium 驱动程序实例有两个属性来表征它与 selenium webdriver 的连接 - 连接 url 和 session ID。通过将这些设置为已经运行的值,您可以有效地“劫持”它,并且可以自由使用。
免责声明 - 该解决方案使用内部 SE 结构,因此可以在较新版本上中断。此外,当您连接到正在运行的 webdriver 时, Remote
一,即使您想关闭它也无法关闭 - 因此这可能导致运行它的机器上的资源泄漏;例如该 webdriver 最终必须由任务管理器手动终止。
所以首先要做的事情是——你有一个正在运行的浏览器实例,你需要获取它的属性以供将来连接。他们是 2 - driver.command_executor._url
, 和 driver.session_id
哪里driver
是正在运行的实例的对象名称。这个python代码将做到这一点:
from robot.libraries.BuiltIn import BuiltIn
def return_driver_props()
seLib = BuiltIn().get_library_instance('SeleniumLibrary')
# the driver is instantiated in the SeleniumLibrary, but not provided publicly, thus accessing it through this py code
remote_url = seLib.driver.command_executor._url # for local instance, this is a value in the form 'http://localhost:57856'
session_id = seLib.driver.session_id
return remote_url, session_id
${conn_url} ${session_id}= Return Driver Props
# and do whatever is needed to make them known - log, store in a file, DB, etc.
Open Browser
并指定远程连接:
Open Browser about:about remote_url=${that_known_url} browser=${the_used_browser_type} # the last args - chrome|firefox|edge - whatever you're connecting two
def set_driver_session_id(sesion_id):
""" Sets the sessoin_id of the current driver insance to the provided one. """
seLib = BuiltIn().get_library_instance('SeleniumLibrary')
if seLib.driver.session_id != sesion_id: # this is pretty much guaranteed to be the case
seLib.driver.close() # this closes the session's window
seLib.driver.quit() # for remote connections (like ours), this deletes the session, but doesn't stop the SE
# set to the session that's already running
seLib.driver.session_id = sesion_id
Set Driver Session ID ${session_id}
关于selenium - 机器人框架 : Reuse existing Browser Window between Tests,我们在Stack Overflow上找到一个类似的问题: https://stackoverflow.com/questions/31661189/
在 Firefox 扩展的 Javascript 中,您可以调用 gBrowser.getBrowserForTab但是没有gBrowser.getTabForBrowser .所以我写了自己的并且它
在问这个可能含糊不清的问题之前,我搜索了 SO,发现许多对“现代浏览器”的引用,但没有定义。由于这是一个被广泛使用和引用的术语,令我惊讶的是我在 Internet 上找不到定义甚至描述。 那么,在 2
更新:老问题仅适用于 IE11 预览版;浏览器模式在 IE11 最终版本中回归。但有一个问题:它几乎没有用,因为它不模拟条件注释。例如,如果您使用它们在旧版 IE 中启用 HTML5 支持,您将无法再
我的移动页面和短信有问题:链接。该页面主要由基于 Android 和 iOS 的智能手机通过 QR 扫描应用程序访问。 特别是在 iPhone 上,有一些带有集成浏览器的 QR 应用程序(webkit
我想使用 CustomTabsIntent。但是我没有找到androidx的customTabs路径和版本。 最后我得到了这个:androidx.browser:browser:1.0.0 我想知道正
我想将来自不同域(支付提供商)的 ssl 安全页面加载到 iframe 中。据我所知,一些(或全部?)浏览器会在页面的某些部分受到保护而其他部分不安全时警告用户。 这是真的吗? 如果是这样,如果主站点
在 Protractor 中,有 browser.pause() function : Beta (unstable) pause function for debugging webdriver t
我可以使用以下方法检索浏览器日志 browser.manage().logs().get('browser').then(function(browserLog) { logger.info('
当使用 protractor 时,全局变量 browser 似乎具有 browser.driver 的所有功能。 我特地问这个是因为我不确定是使用 browser.wait 还是 browser.dr
面对 Protractor 的计时问题。有时我的 Protractor 测试用例会因网络或性能问题而失败。我已经解决了 browser.sleep() 的现有问题。后来知道了browser.wait(
我仍然无法找到解决此问题的方法。我们有一个启动浏览器窗口的应用程序,但我们使用的底层第三方插件尚不支持 IE9。我知道我可以通过点击 F12 并选择它来切换到 IE8 的浏览器模式。 有没有办法在命令
在 Protractor 脚本中,我总是遇到超时问题,即使我设置了很大的 time out jasmine interval、allscripttimeout...在某些地方,我不得不等到元素出现,比
我正在运行一个 Angular 应用程序,并且在 Protractor 上测试时尝试获取当前 URL。使用哪一个? browser.driver.getCurrentUrl() 或 browser.g
“所有浏览器兼容”和“跨浏览器兼容”有什么区别? “交叉”是什么意思,是指不同的操作系统吗? 如果任何网站在 IE 7、8 FF 3+、Safari 3+ 的桌面版本上运行良好,我们可以说它是跨浏
不明白浏览器同步中的错误阅读文档,其中 gulp 4 真的没有写任何关于它的内容。在 gulp 4 的文档中也没有理解(异步)。如何解决这个问题。谢谢。 bla bla bla bla bla bla
我正在尝试在 ASP.Net C# 代码隐藏中执行“如果浏览器是 IE 且版本低于 9”。 但是,在 chrome 中,以下行: if (Request.Browser.Browser == "IE"
我第一次玩 watir,使用 this site作为指导。我在一个简单的程序(如下)中遇到错误 - 它在第一个非要求行失败,如图所示。 如果我没有运行下面显示的内容,而是删除了该行,它会打开一个空的
下面的 if 条件我认为它是说 - 如果浏览器是 IE 并且 IE 浏览器版本高于 9,但我没有 IE 9 来测试它,所以很难知道正确的输出,这也是不是 100% 的我想要的 bcos 默认情况下该脚
我通过 Pingdom 测试了我的网站并得到了这个: 我进行了搜索,但找不到解决方案。有谁知道我怎样才能得到这个14到100? 最佳答案 不是一个完整的解决方案,但您可以通过将两个请求合并为一个来改善
是否可以禁用浏览器/窗口之间的 HTML5 拖放功能? 我正在使用具有 native HTML5 拖放功能的 Angular2 应用程序,并希望防止用户将其拖动到浏览器窗口之外并防止将可拖动对象拖放到
我是一名优秀的程序员,十分优秀!