I am trying to access an element in Selenium, but none of the typical methods are working. So far I have tried using every variation of 'find_elements_by_x' with no success. I also spent about a day looking at various forums, but nothing seems to be working. I recently used Selenium in another successful project, but the same structure is not working for this particular website. Here is a snippet of the HTML containing the elements I am trying to access:
<input type="text" name="username" id="username" placeholder="Username /
Email" autocapitalize="off" autocorrect="off" required="" ng-
model="credentials.username" class="ng-pristine ng-invalid ng-invalid-
required">
As is probably obvious, this is a username input for logging in. Below are a few lines I have tried so far that have not worked.
from selenium import webdriver
driver = webdriver.Chrome("chromedriver.exe filepath")
driver.get('url')
username = driver.find_element_by_xpath('//input[@id="username"]')
That XPath navigates to the element in question if I search for it using the console in Chrome.
I also tried:
username = driver.find_element_by_name('username')
which also did not work.
I am pretty new to Selenium, and I have no experience at all with HTML, so I don't know if there can be complications in the HTML that that must be taken into account when looking for elements through Selenium. Any help at all is appreciated. This is also my first time posting here, so I hope I did not violate any rules.