-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Signed-off-by: Huong Nguyen <huongg1409@gmail>
- Loading branch information
Huong Nguyen
committed
Sep 23, 2024
1 parent
d77aaa1
commit e3d23d9
Showing
1 changed file
with
32 additions
and
0 deletions.
There are no files selected for viewing
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,32 @@ | ||
from selenium import webdriver | ||
from selenium.webdriver.common.keys import Keys | ||
from selenium.webdriver.common.by import By | ||
from selenium.webdriver.common.action_chains import ActionChains | ||
|
||
def test_layout_html_rendering(): | ||
driver = webdriver.Chrome() | ||
|
||
try: | ||
driver.get("https://docs.kedro.org/") | ||
|
||
# Simulate Cmd+K / Ctrl+K keypress | ||
action = ActionChains(driver) | ||
action.key_down(Keys.COMMAND).send_keys('k').key_up(Keys.COMMAND).perform() # For Mac | ||
|
||
# Retrieve all links under the wy-main-nav class with a tag | ||
links = driver.find_elements(By.CSS_SELECTOR, ".wy-main-nav a") | ||
|
||
# Get the current URL | ||
current_url = driver.current_url | ||
|
||
active_link = None | ||
|
||
for link in links: | ||
if 'active' in link.get_attribute('class').split(): | ||
active_link = link | ||
break | ||
|
||
assert active_link is not None, "No active link found under wy-main-nav class." | ||
|
||
finally: | ||
driver.quit() |