Demo entry 6637964

111

   

Submitted by anonymous on Sep 06, 2017 at 03:31
Language: Python. Code size: 1.1 kB.

import os
from selenium import webdriver
import time
from selenium.webdriver.common.keys import Keys

chromedriver = "C:\Program Files (x86)\Google\Chrome\Application\chromedriver.exe"
os.environ["webdriver.chrome.driver"] = chromedriver

driver = webdriver.Chrome(chromedriver)
driver.get("http://autoops.guahao-inc.com/")


driver.find_element_by_link_text('登陆').click()
driver.find_element_by_name('username').send_keys('zhangjf2')
driver.find_element_by_name('password').send_keys('!fan1018')
driver.find_element_by_class_name('btn-block').click()

time.sleep(2)
driver.execute_script('alert("xxxx");')
time.sleep(5)
# s = driver.find_elements_by_css_selector("ul.nav>li>ul.nav.nav-second-level.collapse>li>a")
# for i in s:
#     href = i.get_attribute("href")
#     js = 'window.open("'+href+'");'
#     driver.execute_script(js)
#     time.sleep(3)


# assert "Python" in driver.title
# elem = driver.find_element_by_name("q")
# elem.send_keys("selenium")
# elem.send_keys(Keys.RETURN)
# assert "Google" in driver.title
driver.close()
driver.quit()

This snippet took 0.00 seconds to highlight.

Back to the Entry List or Home.

Delete this entry (admin only).