def png():
from PIL import Image
img = Image.open('1.png')
z = img.size
data = img.convert('RGB').load()
for i in range(z[0]):
dd =[]
for e in range(z[1]):
s = data[i,e]
if (s[0]>230)==(s[1]>230)==(s[2]>230)==True:#缺口处为白色所以只要出的白色比较多地的方就表示是这个位置
dd.append(s)
else:
pass
if len(dd)>20:
print(i)
return i
def hua():
handles = browser.window_handles
browser.switch_to.window(handles[1])
for i in range(1):
from selenium.webdriver import ActionChains
time.sleep(1)
tu = browser.find_element_by_class_name('undefined')
tu.screenshot('1.png')
x = png()+3
d = browser.find_element_by_class_name('slider')
ActionChains(browser).click_and_hold(d).perform()#按住元素不放 d为元素
ActionChains(browser).move_by_offset(xoffset=x, yoffset=0).perform()#一次向右移动的距离 x为距离单位像素
time.sleep(1)
ActionChains(browser).release(d).perform()
02-11
924
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
04-30
3854
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)
02-21
2922
![](https://csdnimg.cn/release/blogv2/dist/pc/img/readCountWhite.png)