Page 1 of 1

Working File Kolkatta FDP

Posted: Wed May 29, 2024 7:23 am
by admin
chromedriver-win32.zip
Support File 3
(7.75 MiB) Downloaded 16 times
Code for Browser Automation[/size]


Use IDLE or Jupyter Notebook

Code: Select all

import time
from selenium import webdriver
from selenium.webdriver.common.by import By
##from selenium.webdriver.support.ui import WebDriverWait
##from selenium.webdriver.support import expected_conditions as EC
##from selenium.webdriver.common.action_chains import ActionChains
from selenium.webdriver.chrome.options import Options

chrome_options = Options()
get_site = "https://services.gst.gov.in/services/searchtp"
# We set the driver Path
chromedriver_path='D:\seleniumDriver\chromeSpecial.exe'
# We set the special chrome for working
chrome_options.binary_location="D:\seleniumDriver\chrome\chrome.exe"
# Let's make a driver to start the application
driver = webdriver.Chrome(options=chrome_options) # service=service,
# Open the website
driver.get(get_site)
# GST No for testing :
gst_no = "27AAECM1259J1ZC"
# GST Site GST No element
gst_no_ele = driver.find_element(By.ID,"for_gstin")
# Put our GST No
gst_no_ele.send_keys(gst_no)
# Get Captcha No from User Input
captcha = input("Please input Captcha :")
# Let's get captcha element :
captcha_ele = driver.find_element(By.ID, "fo-captcha")
# Let's input captcha
captcha_ele.send_keys(captcha)
# Let's press submit button
submit_ele= driver.find_element(By.ID, "lotsearch")
submit_ele.click()
# Put some time delay for the page to be loaded
time.sleep(5)
# Get all data
gst_data = driver.find_element(By.ID, "lottable")
print(gst_data.text)