Monday, October 30, 2017

Python : Automation with python using Chrome

Automation with python using Chrome

1.Open cmd prompt
2. Cd C:\Python34\Scripts\easyinstall.exe selenium
3. After Installation goto
https://sites.google.com/a/chromium.org/chromedriver/downloads
4. Download the latest Driver
5. extract and place chrome driver in any directory
Ex : D:\Tools\python_automation\chromedriver_win32\chromedriver.exe

import os
from selenium import webdriver
from selenium import webdriver
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary

#for i in range(1,50,1):
chrome_options = webdriver.ChromeOptions()
chrome_options.add_argument("--incognito")

chromedriver = "D:\Tools\python_automation\chromedriver_win32\chromedriver.exe"

os.environ["webdriver.chrome.driver"] = chromedriver
driver = webdriver.Chrome(executable_path=chromedriver, chrome_options=chrome_options)
driver.maximize_window()

driver.get("https://hide.me/en/proxy") #driver.get("https://whoer.net/webproxy")
driver.find_element_by_xpath("//div[@class='input-group']//input").send_keys("voting")
driver.find_element_by_xpath("//button").click()

driver.find_element_by_xpath("//div[@class='wp-polls-ans']//li//*[text()='waker']").click()
driver.find_element_by_xpath("//input[@name='vote']").click()

No comments:

Post a Comment