Issue
I am trying to click a login button after filling out all the information for the website. So far I have been able to fill in spaces using driver.find_element("id","username").send_keys("username")
when I use driver.find_element_id("username").send_keys("username")
it wont work.
The login button elements are class=radius and type=sumbit also i class="fa fa-2x fa-sign-in" (I would just link the site but I dont know if that would be against TOS)
So far I have used the following commands
element = driver.find_element_by_link_text("Login")
element.click()
driver.find_element_by_xpath(//*[@id="login"]/button.click()
but xpath gives an "unresolved reference"
I am using IDE PyCharm Build #PC-222.4167.33 on Windows
Solution
Try this code:
driver.find_element(By.ID, "username").send_keys("<enter the username>")
driver.find_element(By.ID, "password").send_keys("<enter the password>")
time.sleep(1)
driver.find_element(By.CSS_SELECTOR, ".radius").click()
time.sleep(2)
driver.find_element(By.CSS_SELECTOR, ".button.secondary.radius").click()
time.sleep(2)
I have added 'time.sleep()
' just to show you it is working correctly, avoid using it in your real-time projects.
Answered By - AbiSaran
0 comments:
Post a Comment
Note: Only a member of this blog may post a comment.