-
Notifications
You must be signed in to change notification settings - Fork 0
Expand file tree
/
Copy pathprobe_jamf.py
More file actions
65 lines (55 loc) · 1.95 KB
/
Copy pathprobe_jamf.py
File metadata and controls
65 lines (55 loc) · 1.95 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
import time
import os
import logging
from backend.auth_service import AuthService
from selenium.webdriver.common.by import By
from selenium.webdriver.support.ui import WebDriverWait
from selenium.webdriver.support import expected_conditions as EC
logging.basicConfig(level=logging.INFO)
script = """
function extractText() {
// Try to get text directly
let el = document.querySelector('.component-main, #designed-reader-content, body');
if (el) return el.innerText;
return "Not found";
}
return extractText();
"""
def probe_again():
auth = AuthService()
try:
driver = auth.get_driver(headless=False)
article_url = "https://learn.jamf.com/r/en-US/jamf-pro-documentation-current/Google_Secure_LDAP_Integration"
driver.get(article_url)
# Click cookie consent if present
try:
btn = WebDriverWait(driver, 5).until(
EC.element_to_be_clickable((By.ID, "onetrust-accept-btn-handler"))
)
btn.click()
print("Accepted cookies via #onetrust-accept-btn-handler")
time.sleep(2)
except Exception:
pass
# Wait up to 15 seconds for .ft-title or content inside designed-reader-content
try:
WebDriverWait(driver, 15).until(
EC.presence_of_element_located((By.CSS_SELECTOR, "h1, .ft-title"))
)
except Exception:
pass
time.sleep(2)
# Print all text found
text = driver.execute_script(script)
with open("jamf_text2.txt", "w", encoding="utf-8") as f:
f.write(text)
print("Saved jamf_text2.txt length:", len(text))
# Also dump HTML again
with open("jamf_dump2.html", "w", encoding="utf-8") as f:
f.write(driver.page_source)
except Exception as e:
print(f"Error: {e}")
finally:
auth.close()
if __name__ == "__main__":
probe_again()