add moveing of tabs and groups, multi browser support, auto complite into terminal, extract html and adding testing

This commit is contained in:
2026-04-09 01:41:01 +02:00
parent 0cb2f1cb3f
commit ab4ba97886
19 changed files with 1069 additions and 57 deletions
+49
View File
@@ -0,0 +1,49 @@
"""Tests for extract.* commands (require an http/https active tab)."""
import pytest
from browser_cli.client import send_command
def test_extract_links(browser, http_tab):
browser("tabs.active", {"tabId": http_tab["id"]})
links = browser("extract.links")
assert isinstance(links, list)
for lnk in links:
assert "href" in lnk
assert "text" in lnk
def test_extract_images(browser, http_tab):
browser("tabs.active", {"tabId": http_tab["id"]})
images = browser("extract.images")
assert isinstance(images, list)
for img in images:
assert "src" in img
assert img["src"] != ""
def test_extract_text(browser, http_tab):
browser("tabs.active", {"tabId": http_tab["id"]})
text = browser("extract.text")
assert isinstance(text, str)
assert len(text) > 0
def test_extract_html(browser, http_tab):
browser("tabs.active", {"tabId": http_tab["id"]})
html = browser("extract.html")
assert isinstance(html, str)
assert "<" in html
def test_dom_exists(browser, http_tab):
browser("tabs.active", {"tabId": http_tab["id"]})
result = browser("dom.exists", {"selector": "body"})
assert result is True
def test_dom_query(browser, http_tab):
browser("tabs.active", {"tabId": http_tab["id"]})
elements = browser("dom.query", {"selector": "body"})
assert isinstance(elements, list)
assert len(elements) > 0
assert elements[0].get("tag") == "body"