-
-
Save muditlambda/5d640598b5f5c880c7a4997552f293db to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
from selenium import webdriver | |
import time | |
import pytest | |
@pytest.fixture | |
def FFExt2(): | |
# the value you pass to parameter should be the name of folder which represents your target Firefox profile, you created earlier | |
profile = webdriver.FirefoxProfile("G:\\7m1dwmtw.FFExt") | |
driver = webdriver.Firefox(profile) | |
time.sleep(5) | |
driver.get("about:support") | |
addons = driver.find_element_by_xpath('//*[contains(text(),"Add-ons") and not(contains(text(),"with"))]') | |
driver.execute_script("arguments[0].scrollIntoView();", addons) | |
addons1 = driver.find_elements_by_xpath('//*[contains(text(),"Add-ons") and not(contains(text(),"with"))]/following-sibling::*[1]/*[2]/*/*[1]') | |
addonsList = [] | |
for addon in addons1: | |
addonsList.append(addon.text) | |
time.sleep(10) | |
driver.quit() | |
return addonsList | |
# this is the test function that will assert whether addon is present in the list of installed addons returned by FFExt function. | |
def test_addon(FFExt2): | |
ghostery = "Ghostery – Privacy Ad Blocker" | |
assert ghostery in FFExt2 |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment