I have a website with the following items:
<input type="text" style="width:230px;" name="email"></input>
and
<input type="password" style="width:230px;" name="password"></input>
With the following python code trying to set values (know username and password are set earlier in code):
Helper.getElementByxPath(mydriver,'//*[@name="email"]',username);
Helper.getElementByxPath(mydriver,'//*[@type="password"]',password);
And Helper.getElementByxPath is defined as:
def getElementByxPath(mydriver,xPath,valueString):
try:
a = mydriver.find_element_by_xpath(xPath);
a.send_keys(valueString);
return 1;
except:
return 0;
I get the following errors:
Unexpected error: <class 'selenium.common.exceptions.NoSuchElementException'>
Unexpected error: <class 'selenium.common.exceptions.NoSuchElementException'>
What am I possibly doing wrong here? Banging my head against a wall.
I am an idiot, my desired form was embedded in a frame. Within a frame.
frameoriframe. If the elements are in a frame/iframe, you can useswitch_to_frame(IDENTIFIER), where IDENTIFIER is the frame name, the frame webelement, or the index of the frame. Or it could be that the elements are loading slowly or after the page completes loading.switch_to_frame