简体   繁体   English

暂停并恢复硒执行

[英]pause and resume Selenium execution

I am looking for an option to pause and resume Selenium execution. 我正在寻找暂停和恢复Selenium执行的选项。

  1. start the selenium execution 开始执行硒

2. pause at a certain step explicitly by some means (commandline/in-line code/manually) 2.通过某种方式(命令行/内联代码/手动)明确地停在某个步骤

  1. continue execution 继续执行

I know that we can keep 我知道我们可以继续

Thread.sleep()

or 要么

time.sleep

I want to give the pause dynamically in between the execution of a test case. 我想在测试用例执行之间动态地给出暂停。

Programming language can be Java or Python. 编程语言可以是Java或Python。

is there a way in java or python to pass a pause to the execution dynamically?(probably that can help) java或python中是否有办法动态地将暂停传递给执行?(可能有帮助)

Any thoughts and solutions are greatly appreciated. 任何想法和解决方案都将不胜感激。

使用IDE,设置断点并调试脚本。

For Python, use can use pdb for debugging. 对于Python,可以使用pdb进行调试。 Just drop the following line at the step where you want to pause and it will drop you into the debugger. 只需将以下行放在您要暂停的步骤,它将使您进入调试器。 You might have to get a little familiar with pdb 您可能需要对pdb有所了解

import pdb; pdb.set_trace()

I found a way where we can do dynamically(no explicitly mentioning breakpoints or typing a line of code at a particular step).Get the process ID of my selenium script and fire below two commands for pausing and continuing whenever I want. 我找到了一种可以动态进行操作的方法(没有在特定步骤明确提及断点或键入一行代码)。获取我的Selenium脚本的进程ID并在以下两个命令下触发,以便在需要时随时暂停和继续。

kill -SIGSTOP [pid]

kill -SIGCONT [pid]

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM