Python Can';在Microsoft窗体的Microsoft登录页上找不到元素

Python Can';在Microsoft窗体的Microsoft登录页上找不到元素,python,selenium,webdriver,Python,Selenium,Webdriver,我目前正在尝试使用xpath(其他的)来定位Microsoft登录页的电子邮件输入框,但是在多次尝试之后,我仍然找不到正确的元素 从页面复制元素后,这是给定的元素: <input type="email" class="form-control" placeholder="Email, phone, or Skype" aria-required="true" spellcheck="false" autocomplete="off" data-bind="

我目前正在尝试使用xpath(其他的)来定位Microsoft登录页的电子邮件输入框,但是在多次尝试之后,我仍然找不到正确的元素

从页面复制元素后,这是给定的元素:

<input type="email" class="form-control" placeholder="Email, phone, or Skype" aria-required="true" spellcheck="false" autocomplete="off" data-bind="
                                    hasFocus: focus,
                                    textInput: email,
                                    attr: {'placeholder': config.text.emailPlaceHolder, 'aria-invalid': !error}">
我尝试了多次,但仍然无法获得正确的元素继续。输入后,我已成功捕获登录元素,但仍停留在下一页


请注意,这与此类似,但与页面元素不同。任何帮助都将不胜感激

您的目标元素以
id
hrdIframe
的形式出现在iframe中。因此,在与元素交互之前,必须切换到帧

driver.switch_to.frame('hrdIframe')
driver.find_element_by_xpath("//input[@type='email']").send_keys(config.username)
始终确保在完成iframe中的操作后切换回默认帧

driver.switch_to.frame('hrdIframe')
driver.find_element_by_xpath("//input[@type='email']").send_keys(config.username)