[心缘地方]同学录
首页 | 功能说明 | 站长通知 | 最近更新 | 编码查看转换 | 代码下载 | 常见问题及讨论 | 《深入解析ASP核心技术》 | 王小鸭自动发工资条VBA版
登录系统:用户名: 密码: 如果要讨论问题,请先注册。

[备忘]python,selenium,firefox获取扩展的uuid

上一篇:[备忘]linux下chrome的headless加载扩展
下一篇:[备忘]python,selenium,firefox安装扩展

添加日期:2020/8/24 5:05:13 快速返回   返回列表 阅读1269次


#获取uui的json文本
def get_preference(d,name):

    d.get('about:config')
    #<button autofocus="" id="warningButton" data-l10n-id="about-config-intro-warning-button">接受风险并继续</button>
    element = find(d,"//button[@id='warningButton']")
    element.click()
    
    #<input type="text" id="about-config-search" data-l10n-id="about-config-search-input1" placeholder="搜索首选项名称">
    element = find(d,"//input[@id='about-config-search']")
    element.send_keys(name)
    element.send_keys(Keys.ENTER)

    element = find(d,"//td[@class='cell-value']/span/span")
    return element.text

#获取扩展的uuid
def getExtendUUID(d,extName):
    #{"doh-rollout@mozilla.org":"98a8be8f-d217-4aa9-aa41-fc8f4fbee980",.....}
    uuids = get_preference(d,"extensions.webextensions.uuids")
    result = json.loads(uuids)
    return result[extName]



#{9a..这个是我的扩展的名字。
extUUID = getExtendUUID(d,"{9a253c57-0e95-4589-be64-365b3602c564}")
 

评论 COMMENTS
没有评论 No Comments.

添加评论 Add new comment.
昵称 Name:
评论内容 Comment:
验证码(不区分大小写)
Validation Code:
(not case sensitive)
看不清?点这里换一张!(Change it here!)
 
评论由管理员查看后才能显示。the comment will be showed after it is checked by admin.
CopyRight © 心缘地方 2005-2999. All Rights Reserved