Adsense

Python selenium launch browser

from selenium import webdriver
from selenium.webdriver.common.keys import Keys
from selenium.webdriver.support.wait import WebDriverWait
from selenium.webdriver.firefox.firefox_profile import FirefoxProfile
from selenium.webdriver.firefox.firefox_binary import FirefoxBinary
from selenium.webdriver.common.desired_capabilities import DesiredCapabilities




import time


def main():
   
    category_id = int(input("Enter the category id: "))
    platform_id = int(input("Enter the platform id: "))
    build_id = int(input("Enter the build id: "))
    result_list = raw_input("Enter the result_list: ")   
    query = "(db.results.category_id=='%d')&(db.results.platform_id=='%d')&(db.results.build_id=='%d') &(db.results.result_list.contains('%s'))" %(category_id, platform_id, build_id, result_list)
    print query
   
   
  
    options = webdriver.ChromeOptions()
    options.add_argument("user-data-dir=C:\\Users\\abckmuthuk2\\AppData\\Local\\Google\\Chrome\\User Data") #Path to your chrome profile
    browser = webdriver.Chrome(executable_path='C:\\Python27\\Scripts\\chromedriver.exe')
   



   
   
    url = "https://smtuvbu-tools-ha/rm-auto-tracker/appadmin/select/db"
    #driver = webdriver.Firefox(executable_path=r'C:\Users\abckmuthuk2\geckodriver\geckodriver.exe', firefox_profile=profile)
    browser.get(url)
   
    time.sleep(5)
    if browser.find_element_by_name('password'):
       u = browser.find_element_by_name('password')
       u.send_keys('web2py')
       s = browser.find_element_by_name('login')
       s.send_keys(Keys.RETURN)
       time.sleep(5)
       k= browser.find_element_by_name('query')
       k.send_keys(query)
       s = browser.find_element_by_xpath("//input[@value='submit']")
       s.send_keys(Keys.RETURN)
       time.sleep(5)
       s = browser.find_element_by_value("submit")

if __name__ == '__main__':
    main()

2 comments:

comment here

newest questions on wordpress