I have a problem. I want to find the login page of several websites using Selenium. To do this, I try to go to the page and click the button with text such as "sign in", "login", and so on. This worked for Netflix. Example:
Code Website: Netflix.com
<a href="/login" class="authLinks redButton" data-uia="header-login-link">Sign In</a>
My Code to detect the button:
result = "https://www.microsoft.com"
driver.get(result)
elem = driver.find_element_by_link_text('Sign In').click
print(driver.current_url) # returns the website: https://www.netflix.com/de-en/login
Now I try this with the website Microsoft.com. Website code as image:
If I now change my contains query to:
driver.find_element_by_link_text('Sign in').click # small "in"
Selenium does not find any element. I have tried many different options that Selenium offers such as:
- find_element_by_id
- find_element_by_name
- find_element_by_link_text
- ...
eg: [https://selenium-python.readthedocs.io/locating-elements.html]
My goal is to use the textual information like "sign in, login" etc. to find the button and press it.
I would be very grateful for your help
