0

I would like to map color HSB values to English color names and Hue names. One resource I have found is https://www.color-blindness.com/color-name-hue/ and I am using Selenium to scrape it. It seems though that I cannot find the elements I am interested in. This is my attemp:

import selenium
from selenium import webdriver

driver = webdriver.Chrome()
driver.get('https://www.color-blindness.com/color-name-hue/')

driver.implicitly_wait(60)

driver.find_element_by_css_selector("input#cp1_Hue")

Some other attempts:

driver.find_element_by_id("cp1_Hue")

I keep getting this error message: NoSuchElementException: Message: no such element: Unable to locate element: {"method":"css selector","selector":"input#cp1_Hue"} (Session info: chrome=89.0.4389.82)

Has anyone faced the same issue?

Thanks in advance!

2
  • solution has been written below Commented Mar 14, 2021 at 19:52
  • Try this link to scrape whatever you wanted from the link in your post. The good news is you can use this link within requests module as the content available here are static. Commented Mar 14, 2021 at 20:20

1 Answer 1

1

There's Iframe element, what doesn't allow to interact with elements inside it.

  1. You should switch on it
  2. Interact with elements what you're looking for

try this:

driver = webdriver.Chrome()
driver.get('https://www.color-blindness.com/color-name-hue/')

driver.implicitly_wait(5)

driver.switch_to.frame(driver.find_element(By.TAG_NAME, 'iframe'))

input = driver.find_element(By.CSS_SELECTOR, "input#cp1_Hue")
input.send_keys(10)

driver.quit()
Sign up to request clarification or add additional context in comments.

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.