On gmx.net I want to click on a hyperlink in an email.
But the hyperlink is enclosed with two iframes.
How do I change into it?
My approach:
WebDriverWait(driver, 10).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.XPATH, '//iframe[@]')))
WebDriverWait(driver, 10).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.XPATH, '//iframe[@]')))
CodePudding user response:
As I suspected, your XPath is incorrect.
You have to either use
WebDriverWait(driver, 10).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.XPATH, '//iframe[@class='app-stack__children l-vertical app-stack__children--active']')))
or
WebDriverWait(driver, 10).until(expected_conditions.frame_to_be_available_and_switch_to_it((By.XPATH, '//iframe[contains(@class, 'app-stack_children--active']')))
Obviously, the first option is better than the second one. There's always a chance that contains() will match more than one element. It is less probable if using equality.


