I'm a bit new when it comes to webscraping and browser automation, so I'd appreciate your help!
My goal using Python's Selenium package is to:
- Go to http://www.mcmaster.com/#orders/
- Log in using the username & password on the side
- Fill out my order in the Quick Order function
The problem is that I identified the xpath for each login field for #2 with this code:
def orderMcMasterParts():
# Open each of the websites required
mcmBrowser = webdriver.Firefox()
mcmBrowser.get('http://www.mcmaster.com/#orders/')
# Log in with my credentials
usernameElem = mcmBrowser.find_element_by_xpath("//input[@class='LoginWebPartLayout_InpBx' and @type='text']")
usernameElem.send_keys(mcmUsername)
passwordElem = mcmBrowser.find_element_by_xpath("//input[@class='LoginWebPartLayout_InpBx' and @type='password')
passwordElem.send_keys(mcmPassword)
passwordElem.submit()
But I continue to get a NoSuchElementException. When I download the HTML on that page with the requests module, I see that none of these fields appear in the HTML code. They appear to exist as Javascript snippets.
My question is how do I interact and type into these fields?