-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathsearch.py
36 lines (33 loc) · 1.13 KB
/
search.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
#coding=utf-8
import time
from splinter import Browser
#test1 init
with Browser() as browser:
# Visit URL
url = "http://www.baidu.com"
browser.visit(url)
browser.fill('wd', 'splinter - python acceptance testing for web applications')
# Find and click the 'search' button
# button = browser.find_by_id('su')
# Interact with elements
time.sleep( 10 )
browser.click_link_by_id('su')
if browser.is_text_present('splinter.readthedocs.io'):
print("Yes, the official website was found!")
else:
print("No, it wasn't found... We need to improve our SEO techniques")
# from splinter import Browser
#
# with Browser() as browser:
# # Visit URL
# url = "http://www.google.com"
# browser.visit(url)
# browser.fill('q', 'splinter - python acceptance testing for web applications')
# # Find and click the 'search' button
# # Interact with elements
# print(browser.find_by_name('btnG'))
# browser.click_link_by_id('btnG')
# if browser.is_text_present('splinter.readthedocs.io'):
# print("Yes, the results was found!")
# else:
# print("No, it wasn't found...")