#获取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}")
|