I want to use selenium to create credentials here , but it shows error :
what "iframe xpath here" should I replace here? here is my code content:
driver = webdriver.Edge()
wait = WebDriverWait(driver, 10)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, "iframe xpath here")))
driver.get("https://ms.web.purview.azure.com/resource/prod0719/main/catalog/management/accountInformation?feature.tenant=72f988bf-86f1-41af-91ab-2d7cd011db47")
driver.set_window_size(1200, 900)
sleep(15)
driver.find_element_by_id("managementCredentials").click()
sleep(5)
Message:
no such element: Unable to locate element: {"method":"css selector","selector":"[id="guided-tour-tag-credentials-new"]"} (Session info: MicrosoftEdge=91.0.864.70)
here is my code content now after switching to iframe:
iframe content:
Looks like it's an iframe, if it is, you need to switch first before interaction :
Code :
wait = WebDriverWait(driver, 10)
wait.until(EC.frame_to_be_available_and_switch_to_it((By.XPATH, "iframe xpath here")))
and then you can interact :
driver.find_element_by_id("guided-tour-tag-credentials-new").click()
Imports :
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.common.by import By
from selenium.webdriver.support import expected_conditions as EC
once done, switch to default content like this :
driver.switch_to.default_content()
The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.