- Trending Categories
Data Structure
Networking
RDBMS
Operating System
Java
MS Excel
iOS
HTML
CSS
Android
Python
C Programming
C++
C#
MongoDB
MySQL
Javascript
PHP
Physics
Chemistry
Biology
Mathematics
English
Economics
Psychology
Social Studies
Fashion Studies
Legal Studies
- Selected Reading
- UPSC IAS Exams Notes
- Developer's Best Practices
- Questions and Answers
- Effective Resume Writing
- HR Interview Questions
- Computer Glossary
- Who is Who
Send keys without specifying element in Python Selenium webdriver
We can send keys without specifying elements in Python with Selenium webdriver. The tagname input is used for all the edit boxes. We shall use the find_element_by_tag_name method and pass input as a parameter to that method.
Thus we need not mention element attributes explicitly. Let us investigate the html code of an element which can be identified with tagname input.
Example
from selenium import webdriver #set geckodriver.exe path driver = webdriver.Firefox(executable_path="C:\geckodriver.exe") driver.implicitly_wait(0.5) driver.get("https://www.tutorialspoint.com/index.htm") #identify element with tagname l = driver.find_element_by_tag_name("input") l.send_keys("Selenium") #obtain value obtained print("Value entered: ") print(l.get_attribute('value')) driver.quit()
Output
- Related Articles
- How to send cookies with selenium webdriver?
- How to send a report through email using Selenium Webdriver?
- How to send keyboard input to a textbox on a webpage using Python Selenium webdriver?
- How can I handle multiple keyboard keys using Selenium Webdriver?
- Finding an element in a sub-element in Selenium Webdriver.
- Maximize WebDriver (Selenium 2) in Python.
- How to click on hidden element in Selenium WebDriver?
- Test if element is present using Selenium WebDriver?
- How do I find an element that contains specific text in Selenium WebDriver (Python)?
- Running Selenium WebDriver python bindings in chrome.
- How to Resolve Stale Element Reference Exception in Selenium WebDriver?
- Verifying whether an element present or visible in Selenium Webdriver
- How install Selenium Webdriver with Python?
- Test if an element is focused using Selenium Webdriver.
- Running Selenium Webdriver with a proxy in Python.

Advertisements