1

I am trying to use selenium on this site(https://www.kijiji.ca/t-login.html)

here is the code I use

driver=webdriver.Chrome(PATH)

driver.get("https://www.kijiji.ca/t-login.html")

driver.find_element_by_id("emailOrNickname")

but I keep getting

selenium.common.exceptions.NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"[id="emailOrNickname"]"}
3
  • url is not valid Commented Jul 25, 2020 at 9:41
  • Using name attribute instead of id may solve your problem. Commented Jul 25, 2020 at 9:53
  • @madogan same problem, Commented Jul 25, 2020 at 10:00

4 Answers 4

1

Try

from bs4 import BeautifulSoup
soup = BeautifulSoup(driver.page_source, 'html.parser')
soup.find_all('input', {'id': 'emailOrNickname'})`
Sign up to request clarification or add additional context in comments.

2 Comments

``` AttributeError: 'WebDriver' object has no attribute 'find_all' ```
Edited, but requires BeautifulSoup.
1

I think this website detects selenium. Because I can reach the site with normal browser but selenium does not show anything at login or register page. You need to bypass it if possible.

Comments

1

There's nothing wrong with your code. If you look at the response headers from the site you will see

server: rhino-core-shield

This is an indication that the server could be protected by a web application firewall.

If you inspect what you're actually getting back from the website using

driver.page_source

you will see that you're not actually getting the login page you expected, instead you are getting a horrible pile of Javascript which will presumably redirect to the real login page. The upshot is that this particular website's login page is going to be quite difficult to access programatically.

Comments

0

please use following xpath to click and sendkeys to email field

 driver=webdriver.Chrome(PATH)

driver.get("https://www.kijiji.ca/t-login.html")

driver.find_element_by_xpath("//input[@id="emailOrNickname"]");

Comments

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.