When I click a button in my process, it automatically copies an email address. How can I verify that the copied value matches my expectations? I was attempting to paste it into the terminal to check, but if there is a more efficient method to do this, I would appreciate any suggestions.
I attempted to import pyperclip based on another recommendation, but unfortunately, it did not import correctly.
Here is the code for the button that handles the copying functionality upon clicking:
@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()
Upon clicking the button, it triggers the default email client to open a second window which we then close with the following step:
@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])
My expectation is to retrieve the copied email, but so far none of my attempts have been successful.