F5 and F3 function keys doesn't do anything - Python

11 views
Skip to first unread message

Đặng Trang

unread,
Jun 4, 2023, 12:29:33 AM6/4/23
to Selenium Users
Hi, when I tried the code below, it will input "123" 5 times in the search bar of the website and print "volunteer" 5 times, but F3 does nothing (it's supposed to pop up the find bar at the bottom of the page)

Same thing happened when I tried F5 key, it does absolutely nothing. The only thing these keys seem to do is scroll down to the bottom of the page. Another strange thing is the browser controlled by selenium doesn't seem to refresh properly. When I hit refresh, the text I input in the search box is still there no matter how many times I refresh manually.

I suspect other F# function keys might not do anything as well. Where did this problem come from? Your help is truly appreciated
import time
from selenium import webdriver
 
from selenium.webdriver.common.keys import Keys
driver = webdriver.Firefox()

time.sleep(3)

txtb = driver.find_element('css selector', 'body > header > div > div.navbar-header > div.navbar-search.navbar-right.hidden-xs > form > div > input')
htmlelem = driver.find_element('tag name', 'html')
for n in range(5):
    txtb.send_keys(123)
    htmlelem.send_keys(Keys.F3)
    print("volunteer")
Reply all
Reply to author
Forward
0 new messages