简体   繁体   English

没有这样的元素:无法定位元素:{“method”:“css selector”,“selector”:“[id=”guided-tour-tag-credentials-new“]”}

[英]no such element: Unable to locate element: {“method”:“css selector”,“selector”:“[id=”guided-tour-tag-credentials-new“]”}

I want to use selenium to create credentials here , but it shows error :我想在这里使用 selenium 创建凭据,但它显示错误:

what "iframe xpath here" should I replace here?我应该在这里替换什么“iframe xpath”? 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 后的代码内容: 在此处输入图片说明

iframe content: iframe 内容:

screenshot2:截图2: 在此处输入图片说明

screenshot3:截图3: 在此处输入图片说明

Looks like it's an iframe, if it is, you need to switch first before interaction :看起来是一个iframe,如果是,则需要在交互之前先切换:

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()
  1. Possibly you have to add wait before accessing that element to let him loaded.可能您必须在访问该元素之前添加等待以让他加载。
  2. Possibly it is inside an iframe.可能它在 iframe 内。
  3. Possibly the id attribute is dynamically changing on the page可能 id 属性在页面上动态变化

暂无
暂无

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

相关问题 无法找到硒中的元素:{“方法”:“ css选择器”,“选择器”:“ [id =” identifierId”]”} - Unable to locate element: {“method”:“css selector”,“selector”:“[id=”identifierId“]”} in selenium NoSuchElementException:消息:没有这样的元素:无法找到元素:{"method":"css selector","selector":"[id="events_table"]"} - NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="events_table"]"} 收到消息:没有这样的元素:无法找到元素:{"method":"css selector","selector":"[id="None"]"} Python 使用 selenium 时 - Getting Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="None"]"} Python when using selenium 消息:没有这样的元素:无法找到元素:{“method”:“css selector”,“selector”:“[id=”loginUsername“]”} - Message: no such element: Unable to locate element: {“method”:“css selector”,“selector”:“[id=”loginUsername“]”} 无法定位元素:{“method”:“css selector”,“selector”:“.Mr508”} - Unable to locate element: {“method”:“css selector”,“selector”:“.Mr508”} 使用 Selenium Python 选择下拉菜单 - 无法定位元素:{“method”:“css selector”,“selector”:"[id= - Selecting drop-down using Selenium Python - Unable to locate element: {“method”:“css selector”,“selector”:"[id= selenium.common.exceptions.NoSuchElementException:消息:没有这样的元素:无法找到元素:{“方法”:“css选择器”,“选择器”:“.ui流感~”} - selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":".ui flu~"} 消息:没有这样的元素:无法定位元素:{“method”:“css selector”,“selector”:“[name=”uID“]”} - Message: no such element: Unable to locate element: {“method”:“css selector”,“selector”:“[name=”uID“]”} Selenium NoSuchElementException-无法找到元素:{“方法”:“ css选择器”,“选择器”:“ [[名称=”电子邮件地址”]”} - Selenium NoSuchElementException - Unable to locate element: {“method”:“css selector”,“selector”:“[name=”emailAddress“]”} NoSuchElementException:消息:没有这样的元素:无法找到元素:{"method":"xpath","selector":"//*[@id="my id"]"} - NoSuchElementException: Message: no such element: Unable to locate element: {"method":"xpath","selector":"//*[@id="my id"]"}
 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM