我正在尝试使用一个带有Selenium的机器人来输入电子邮件和密码。使用百思买的网站。
这是我目前拥有的代码块:
browser.find_element_by_xpath("/input[@id='fld-e']").send_keys("EMAIL@gmail.com")然而,当我实际运行程序时,并没有发送任何输入。下面是附加在电子邮件块上的HTML代码,以及我从一个铬扩展名中提取的XPath :我尝试使用.find_element_by_class_name("fld-e")
<input class="tb-input " type="email" autocomplete="off" id="fld-e" name="fld-e" placeholder="" required="" value="">
/html/body/div[@class='cia-app-container']/div[@class='cia-actual-full-page-wrapper lv']/section[@class='cia size-l cia--two-column-v2']/main[@class='cia-wrapper container']/div[@class='cia-wrapper__main']/div[@class='cia-content js-cia-content']/div[@class='cia-main-container']/div[@class='cia-settings-container']/div/div[@class='cia-signin']/form[@class='cia-form ']/div[@class='cdi-input cdi-wrapped-text']/div[@class='tb-input-wrapper tb-input-wrapper-full-width']/input[@id='fld-e']任何帮助都将不胜感激,谢谢!
发布于 2021-05-03 21:52:36
试试这个xpath:
driver.find_element_by_xpath("//input[@type='email']")如果它不起作用,在您的问题中添加更多您正在使用的html代码。您也可以尝试driver.find_element_by_id("fld-e"),但我怀疑它是否会起作用。
此外,等待直到字段是可点击的。
https://stackoverflow.com/questions/67375984
复制相似问题