Python Forum
Posting value from excel to Form (Python+Selenium)
Thread Rating:
  • 0 Vote(s) - 0 Average
  • 1
  • 2
  • 3
  • 4
  • 5
Posting value from excel to Form (Python+Selenium)
#1
import selenium
import time
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.common.exceptions import NoSuchElementException
pass_email = df['Email'].tolist()
type(pass_email)

#using chrome to access web
driver = webdriver.Chrome("path\\chromedriver.exe")
#open the specific page 
driver.get("url")
#find the fields where the value needs to be entered
for value in pass_email:
    try:
        text_input = driver.find_element_by_xpath("//input[contains(@id, 'f_f2ce5e85a5f51997dfcb1f8e645a3c2d')]")
        text_input.clear()
        text_input.send_keys(value)
        time.sleep(2)
        sub_btn = driver.find_element_by_xpath("//input[contains(@id, 'btnSubmit')]")
        sub_btn.click()
        time.sleep(2)
    except NoSuchElementException:
            continue
I have tried above code to pull the values from list and post it in a form and submit. However, it's getting stopped after first iteration.

Thank you in advance.
Reply


Possibly Related Threads…
Thread Author Replies Views Last Post
  Using Python request without selenium on html form with javascript onclick submit but eraosa 0 3,171 Jan-09-2021, 06:08 PM
Last Post: eraosa
  Using python within an html form t4keheart 5 5,422 Aug-17-2020, 12:28 PM
Last Post: t4keheart
  Instagram Bot _ Posting Comments kristianpython 3 3,333 May-23-2020, 12:54 PM
Last Post: kristianpython
  Error posting with requests julio2000 6 2,855 Mar-28-2020, 09:43 PM
Last Post: julio2000
  Posting html values to views/models in Django Malt 1 2,157 Sep-04-2019, 01:44 PM
Last Post: fishhook
  Python - Scrapy Login form Baggelhsk95 4 10,772 Oct-16-2018, 08:01 AM
Last Post: Baggelhsk95
  Edit Form using Selenium Prince_Bhatia 2 3,931 Feb-14-2018, 10:31 PM
Last Post: snippsat
  Python....excel....html form tarliver 2 7,327 Dec-20-2017, 07:02 AM
Last Post: buran
  Error in Selenium: CRITICAL:root:Selenium module is not installed...Exiting program. AcszE 1 3,627 Nov-03-2017, 08:41 PM
Last Post: metulburr
  Selenium to pick data from excel and enter into backend Prince_Bhatia 0 2,994 Aug-30-2017, 10:32 AM
Last Post: Prince_Bhatia

Forum Jump:

User Panel Messages

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