Python Forum
Code example for entering input in a textbox with requests/selenium object
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Code example for entering input in a textbox with requests/selenium object
#1
Hi, I am scrapping a website with requests/selenium and I want to enter some text into a textbox and click a button on the returned page. I had seen few code snippets for this in some of the threads in this forum, but cant locate them now. Can someone please point me to one of those examples.

send_keys() - That is what I was looking for. Found it at below thread

https://python-forum.io/Thread-How-to-se...ing-python
Reply
#2
first, import 'By' by adding at top: from selenium.webdriver.common.by import By
Then you need to locate the button.
you do this by using the inspect option:
  • right click on button
  • select inspect element
  • right click on highlighted html
  • select copy-->XPATH
  • Paste into statement: browser.find_element(By.XPATH, 'Paste here').click()
  • That should do it
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  POST requests - different requests return the same response Default_001 3 1,956 Mar-10-2022, 11:26 PM
Last Post: Default_001
  Selenium Page Object Model with Python Cryptus 5 3,992 Aug-19-2020, 06:30 AM
Last Post: mlieqo
  selenium Ctrl + F input metulburr 4 6,288 Jul-14-2019, 01:12 PM
Last Post: metulburr
  Error when running .py file but not when entering exact same code in CLI Broadsworde 3 2,756 Dec-11-2018, 09:06 AM
Last Post: Broadsworde
  Python requests.get() returns broken source code instead of expected source code? FatalPythonError 3 3,734 Sep-21-2018, 02:46 PM
Last Post: nilamo
  How to send keys at beginning of textbox using python Prince_Bhatia 2 3,078 May-21-2018, 08:15 AM
Last Post: Prince_Bhatia
  Simple Element Check Code in Selenium Not Working digitalmatic7 1 3,016 Feb-18-2018, 06:53 AM
Last Post: metulburr
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,647 Nov-03-2017, 08:41 PM
Last Post: metulburr
  Can't extract hidden input using Selenium!!! Shaggy89 1 2,840 Jul-12-2017, 12:24 PM
Last Post: metulburr

Forum Jump:

User Panel Messages

Announcements
Announcement #1 8/1/2020
Announcement #2 8/2/2020
Announcement #3 8/6/2020