在我的步骤中,我单击了一个自动复制电子邮件地址的按钮。我如何断言该值是我期望的值?试图找出一种将其粘贴到终端中的方法,以便我可以看到它在复制什么,但是如果有更有效的方法来做到这一点,我很想知道。
我尝试根据其他一些建议导入 pyperclip,但没有正确导入。
这是点击时复制值的按钮,
@step('I locate the email icon and click')
def step_impl(context):
window_before = driver.window_handles[0]
context.current_element = context.wait.until(
EC.element_to_be_clickable(
(EMAIL_ICON)
)
)
scroll_to_webelement(context.driver, context.current_element)
time.sleep(3)
context.current_element.click()
它会触发您操作系统的默认电子邮件以打开第二个窗口,以便将其关闭
@step('I switch to the new window and close it')
def step_impl(context):
context.wait.until(EC.number_of_windows_to_be(2))
context.driver.switch_to.window(context.driver.window_handles[-1])
context.driver.close()
context.driver.switch_to.window(context.driver.window_handles[0])
我希望它给我复制的电子邮件,但我尝试的每一步似乎都不起作用。
慕尼黑5688855
精慕HU
相关分类