-
Notifications
You must be signed in to change notification settings - Fork 0
/
Copy pathasd.py
77 lines (58 loc) · 1.84 KB
/
asd.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
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
72
73
74
75
76
77
import pytesseract
from PIL import Image
from selenium.webdriver import Chrome
from selenium.webdriver.common.by import By
from selenium.webdriver.support.relative_locator import with_tag_name
from selenium.webdriver.chrome.options import Options
from selenium.webdriver.common.action_chains import ActionChains
#import selenium.webdriver
stuff=pytesseract.image_to_string(Image.open(r'C:\Users\jadej\OneDrive\Pictures\okokok.jpg'))
#stuff=pytesseract.image_to_boxes(Image.open(r'C:\Users\jadej\OneDrive\Pictures\okokok.jpg'))
def func(str):
return map[str]
print(stuff.split(','))
map={}
options = Options()
options.page_load_strategy = 'eager'
driver = Chrome(options=options)
#driver.implicitly_wait(6)
for items in stuff:
driver.get("https://www.cosdna.com/eng/stuff.php")
print("h0")
searchbar = driver.find_element(By.NAME,'q')
print("h1")
searchbar.clear()
searchbar.send_keys(items)
print(searchbar)
print("h2")
x=driver.find_elements(with_tag_name('a').below(searchbar))
for i in x:
print(i)
print(len(x))
driver.find_element(By.TAG_NAME, 'button').click()
print("h3")
searchbar = driver.find_element(By.NAME, 'q')
x=driver.find_elements(with_tag_name('a').below(searchbar))
for i in x:
print(i.text)
print(len(x))
driver.execute_script("arguments[0].scrollIntoView(true);", x[0])
driver.execute_script("arguments[0].click();", x[0])
try:
searchbar = driver.find_element(By.NAME, 'q')
except Exception as e:
print(items,' not found.')
continue
x=driver.find_elements(with_tag_name('a').below(searchbar))
print("hp")
print(x[0].text)
max=-1
for i in x[0].text:
if(i.isdigit()):
max=int(i)
map[items]=max
print(map)
print("he")
print("h3 over")
driver.quit()
print(map)