Not sure why this error is showing up, I've asked various questions relating to this issue already. Webdriver for some reason, just cannot find the type field i'm looking for, giving me Attribute not found errors as well as NoSuchElementException errors.
Error message:
Traceback (most recent call last):
File "main.py", line 19, in <module>
driver.find_element(By.name,"nickname").send_keys(username Keys.ENTER)
AttributeError: type object 'By' has no attribute 'name'
Line of code:
time.sleep(0.2)
driver.find_element(By.name,"nickname").send_keys(username Keys.ENTER)
HTML:
<input name="nickname" type="text" placeholder="Nickname" maxlength="15" id="nickname" data-functional-selector="username-input" autocomplete="off" value="" aria-expanded="false">
CodePudding user response:
As per The By implementation the set of supported locator strategies are:
CLASS_NAME=class nameCSS_SELECTOR=css selectorID=idLINK_TEXT=link textNAME=namePARTIAL_LINK_TEXT=partial link textTAG_NAME=tag nameXPATH=xpath
Accordingly, you have to change By.name as By.NAME
Effectively, you line of code will be:
driver.find_element(By.NAME,"nickname").send_keys(username Keys.ENTER)
