Issue
I am trying to use a bot with Selenium to input email and a password. Using Best Buy's website.
This is currently the block of code I have:
browser.find_element_by_xpath("/input[@id='fld-e']").send_keys("[email protected]")
Yet no input is being sent when I actually run the program. Here is the HTML code attached to the email block, along with the XPath that I pulled from a chrome extension: I've tried using .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']
Any help would be appreciated, thank you!
Solution
Try this xpath:
driver.find_element_by_xpath("//input[@type='email']")
If it won't work, add to your question more html code which you are working with.
You can also try driver.find_element_by_id("fld-e")
but I have some doubts that it will work.
Also, wait until the field is clickable.
Answered By - vitaliis
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.