1

I want to automate some searching stuff for myself, but I have a bit of a problem here. On this website:

https://shop.orgatop.de/

The program can't find the search bar, and I don't really know why.

driver = webdriver.Firefox() driver.get('https://shop.orgatop.de/') input_search = WebDriverWait(driver, 20).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="solrSearchTerm"]'))) input_search.click() input_search.send_keys('asd') input_search.send_keys(Keys.RETURN) 

1 Answer 1

1

The element is present inside nested iframe like innerFrame>catalog>content>input.You need to switch those frame first inorder to access the input search box.

Induce WebDriverWait() and frame_to_be_available_and_switch_to_it()

driver = webdriver.Firefox() driver.get('https://shop.orgatop.de/') WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"innerFrame"))) WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"catalog"))) WebDriverWait(driver,10).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"content"))) input_search = WebDriverWait(driver, 5).until(EC.visibility_of_element_located((By.XPATH, '//*[@id="solrSearchTerm"]'))) input_search.click() input_search.send_keys('asd') input_search.send_keys(Keys.RETURN) 

Browser snashot:

enter image description here

Sign up to request clarification or add additional context in comments.

4 Comments

It give me an error: File "C:\Users\Aron\Desktop\apa\kereso2.py", line 28, in <module> WebDriverWait(driver,1 0).until(EC.frame_to_be_available_and_switch_to_it((By.NAME,"content"))) File "C:\Python\lib\site-packages\selenium\webdriver\support\wait.py", line 80, in until raise TimeoutException(message, screen, stacktrace)
@Pilv : Try the updated answer now.Elements is present in a nested frames.Let me know how this goes.It worked with me.
Thanks! It works. If it's not much to ask for, can you please explain me why this works?
@Pilv : Just read my answer description.I have mentioned that the Input search box you are interacting it is inside nested frame elements.So selenium can't interact this kind of input directly until you switched those frames first.That is what I did in this code.Thanks.

Start asking to get answers

Find the answer to your question by asking.

Ask question

Explore related questions

See similar questions with these tags.