{"id":5161,"library":"core-universal","title":"Applitools Eyes Core SDK Server (Python Client)","description":"The `core-universal` package is part of the Applitools Eyes SDK ecosystem, serving as the Python client for the Eyes Core SDK Server. It provides the underlying communication protocol (using WebSockets) for Python SDKs (like `eyes-selenium`, `eyes-playwright`, `eyes-appium`) to interact with the Applitools Eyes service, where core functionality is implemented in JavaScript. End-users typically interact with higher-level Applitools SDKs rather than directly with `core-universal`. The current version is 4.16.5. Applitools SDKs are actively maintained with frequent releases.","status":"active","version":"4.16.5","language":"en","source_language":"en","source_url":"https://github.com/applitools/eyes.sdk.javascript1/tree/master/js/packages/core","tags":["Applitools","visual testing","SDK","client","UI testing","automation"],"install":[{"cmd":"pip install core-universal","lang":"bash","label":"Install core-universal"}],"dependencies":[{"reason":"Commonly used with this core component for web UI testing via Selenium.","package":"applitools-eyes-selenium","optional":true},{"reason":"Commonly used with this core component for web UI testing via Playwright.","package":"applitools-eyes-playwright","optional":true},{"reason":"Commonly used with this core component for mobile UI testing via Appium.","package":"applitools-eyes-appium","optional":true}],"imports":[{"note":"End-users typically import from specific Applitools SDKs (e.g., selenium, playwright, appium) that utilize `core-universal` internally, rather than importing directly from `core-universal`.","symbol":"Eyes","correct":"from applitools.selenium import Eyes"},{"note":"Used for managing multiple Eyes sessions without the Ultrafast Grid.","symbol":"ClassicRunner","correct":"from applitools.selenium import ClassicRunner"},{"note":"Used for managing multiple Eyes sessions with the Ultrafast Grid for cross-browser testing.","symbol":"VisualGridRunner","correct":"from applitools.selenium import VisualGridRunner"}],"quickstart":{"code":"import os\nfrom selenium import webdriver\nfrom applitools.selenium import Eyes, ClassicRunner, Target\n\ndef run_applitools_test():\n    # Set your Applitools API key from environment variable\n    # For a quickstart, ensure APPLITOOLS_API_KEY is set in your environment\n    api_key = os.environ.get('APPLITOOLS_API_KEY', 'YOUR_APPLITOOLS_API_KEY_HERE')\n    if not api_key or api_key == 'YOUR_APPLITOOLS_API_KEY_HERE':\n        print(\"Warning: APPLITOOLS_API_KEY environment variable not set. Test might fail.\")\n        # In a real scenario, you'd raise an error or handle this more robustly\n\n    runner = ClassicRunner()\n    eyes = Eyes(runner)\n    eyes.api_key = api_key\n\n    # Configure Eyes to log to console for debugging\n    eyes.log_handler = None # Set to StreamMessageLogger() for console output\n\n    driver = None\n    try:\n        # Initialize a headless Chrome browser (ensure chromedriver is in PATH)\n        options = webdriver.ChromeOptions()\n        options.add_argument('--headless')\n        driver = webdriver.Chrome(options=options)\n\n        # Start the Applitools Eyes test\n        driver = eyes.open(driver=driver, app_name='My Python App', test_name='Simple Login Test', viewport_size={'width': 800, 'height': 600})\n\n        # Navigate to a URL and perform visual checkpoints\n        driver.get('https://demo.applitools.com')\n        eyes.check('Login Page', Target.window().fully())\n\n        # Perform some actions (e.g., filling a form, clicking buttons)\n        # For this example, just navigate to another page\n        driver.find_element_by_id('log-in').click()\n        eyes.check('App Page', Target.window().fully())\n\n        # Close the Eyes test and get results\n        results = eyes.close(raise_exception=True)\n        print(f\"Applitools Test Results: {results}\")\n\n    except Exception as e:\n        print(f\"Applitools test failed: {e}\")\n    finally:\n        if driver:\n            driver.quit()\n        # Always abort the test if it's open, even if an exception occurred\n        eyes.abort_if_not_closed()\n\nif __name__ == '__main__':\n    run_applitools_test()","lang":"python","description":"This quickstart demonstrates a basic visual test using `applitools.selenium`, which is a common way to interact with Applitools Eyes functionality. It initializes a Selenium WebDriver, opens an Applitools Eyes test, performs visual checkpoints on different pages, and then closes the test. Remember to set the `APPLITOOLS_API_KEY` environment variable."},"warnings":[{"fix":"Use a specialized Applitools SDK (e.g., `applitools-eyes-selenium`, `applitools-eyes-playwright`) that wraps `core-universal` for end-to-end visual testing.","message":"Direct import and usage of `core-universal` is generally not intended for end-users. It serves as an internal communication layer for higher-level Applitools SDKs (e.g., `applitools.selenium`, `applitools.playwright`). Developers should use the appropriate specialized SDK for their testing framework.","severity":"gotcha","affected_versions":"All"},{"fix":"Upgrade your Python environment to version 3.10 or higher. Python 3.7 and 3.8 are End-of-Life (EOL).","message":"Applitools Core Tools (which `core-universal` is a part of) version 4.8.0+ no longer supports Python 3.7 and 3.8. Attempting to use these Python versions with newer Core Tools may result in errors.","severity":"breaking","affected_versions":"4.8.0+"},{"fix":"Ensure the `APPLITOOLS_API_KEY` environment variable is correctly set with your valid Applitools API key before running tests. Alternatively, set it programmatically using `eyes.api_key = 'YOUR_API_KEY'`.","message":"The Applitools API Key (`APPLITOOLS_API_KEY`) is crucial for authenticating with the Applitools service. Forgetting to set it, or setting it incorrectly, will prevent tests from running or uploading results.","severity":"gotcha","affected_versions":"All"},{"fix":"Initialize mutable default arguments inside the function if a fresh object is needed for each call, typically by using `None` as the default and checking for it: `def func(arg=None): if arg is None: arg = []`.","message":"Mutable default arguments in Python functions (e.g., `def func(arg=[]):`) can lead to unexpected shared state across function calls. While not specific to `core-universal`, this is a common Python footgun that can affect custom helper functions in test automation.","severity":"gotcha","affected_versions":"All"}],"env_vars":null,"last_verified":"2026-04-13T00:00:00.000Z","next_check":"2026-07-12T00:00:00.000Z"}