Permalink
Cannot retrieve contributors at this time
Name already in use
A tag already exists with the provided branch name. Many Git commands accept both tag and branch names, so creating this branch may cause unexpected behavior. Are you sure you want to create this branch?
ChatBot/webuyanycar.py
Go to fileThis commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
35 lines (35 sloc)
1.6 KB
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
import time | |
from selenium import webdriver | |
from selenium.webdriver.common.keys import Keys | |
from selenium.webdriver.support.ui import Select | |
browser=webdriver.Chrome('C:/Users/chadw/OneDrive/Desktop/chromedriver') | |
browser.get('https://www.webuyanycar.com/') | |
vehicleref=browser.find_element_by_id('vehicleReg') | |
reg = input("What is your registration number") | |
vehicleref.send_keys(reg) | |
vehicleref.submit() | |
time.sleep(3) | |
mileage=browser.find_element_by_id('Mileage') | |
miles = input("how many miles does the vehicle have?") | |
mileage.send_keys(miles) | |
owners = input("How man owners has your vehicle had?") | |
select = Select(browser.find_element_by_id('PreviousOwners')) | |
owners = str(owners) | |
select.select_by_visible_text(owners) | |
select = Select(browser.find_element_by_id('ServiceHistoryId')) | |
serviceHistory = input("Please enter what service history your car has. Options are either; Full, Some, None or First not due.") | |
select.select_by_visible_text(serviceHistory) | |
browser.find_element_by_xpath('//button[normalize-space()="Continue"]').click() | |
time.sleep(3) | |
customername = browser.find_element_by_id('CustomerName') | |
name = input("What is your name?") | |
customername.send_keys(name) | |
customeremail = browser.find_element_by_id('EmailAddress') | |
email = input("What is your email?") | |
customeremail.send_keys(email) | |
customerpostcode = browser.find_element_by_id('Postcode') | |
postcode = input("What is your postcode?") | |
customerpostcode.send_keys(postcode) | |
browser.find_element_by_xpath('//button[normalize-space()="Get my valuation"]').click() | |
time.sleep(3) | |
print("Our valuation from webuyanycar.com has been emailed to you") |