semvec/pypi-packages huggingface dataset:
UI-PIC-REC 1.0.0
Selenium plugin library

# **UI-Pic-Rec**

<p align="center">
<img src="image/12.png" width="600" height="200"/>
</p>

# 本库目前支持的相似性算法

**1.采用SSIM算法（结构相似性算法）：generate_diff_pic_between_ssim**

**2.采用余弦方法：generate_diff_pic_between_vector**

    注意：后续会不断的补充相应的算法，丰富比较的结果
# 安装

    pip install -r requirements.txt
    
    pip install pic-diff-recognizer
    
# 最佳实践

```python
from selenium.webdriver import Chrome,ActionChains
from selenium.webdriver.chrome.options import Options
from selenium import webdriver
from selenium.webdriver.common.keys import Keys
import os
import time
import logging
from pathlib import Path
from findHander import FindHander
from picHander import *

logging.basicConfig(level=logging.INFO,
                    format='%(asctime)s - %(filename)s[line:%(lineno)d] - %(levelname)s: %(message)s') 
logger = logging.getLogger("Example")
chrome_driver='/Users/lijishuang/Downloads/chromedriver' #需要更改成本机目录的地址
options = webdriver.ChromeOptions()
options.add_argument('--headless')
dr = webdriver.Chrome(executable_path=chrome_driver,chrome_options=options)

def function_pic(dr,path_self):
    pt = FindHander(dr.save_screenshot)

    dr.set_window_size(1920, 1080)
    origin_url = 'https://www.baidu.com/'
    dr.get(origin_url)
    dr.implicitly_wait(10)

    pt.get_pic_traverse(path_self)

    elem = dr.find_element_by_name("wd")
    elem.send_keys('今日头条'+ Keys.RETURN)
    time.sleep(5)
    # 截
    pt.get_pic_traverse(path_self)
"""
path_self:定义保存截图的目录，使用 --from pathlib import Path-- 定义路径
使用get_pic_traverse进行需要保存截图的地方使用
"""
path_self_org = Path(os.getcwd()).joinpath('org')
path_self_sap = Path(os.getcwd()).joinpath('sap')
function_pic(dr,path_self_org)
function_pic(dr,path_self_sap)

logger.info(f"Staring ...")
compare_res,file_name_org = compare_result_pic_data()
logger.info(file_name_org)
logger.info(f"Starting SSIM Progress ...")
    
result_score = PicHander(compare_res).generate_diff_pic_between_ssim(file_name_org)

print(result_score)


logger.info(f"Staring ...")
compare_res,file_name_org = compare_result_pic_data()
logger.info(file_name_org)
logger.info(f"Starting Vector Progress ...")
    
result_score = PicHander(compare_res).generate_diff_pic_between_vector(file_name_org)

print(result_score)
```
    执行后会在所调用的脚本目录下生成三个文件夹:
    diff:依据org和sap目录下的图片的名字生成目录，保存每一次比较的记录之间的不同的图片，会在图片中进行标记；
    org:存储待比较的图片信息（第一次产生的信息）；
    sap:存储待比较的图片信息（第二次产生的信息）；
<p align="center">
    <img src="image/13.png" width="200" height="300"/>
</p>
# 联系我