Skip to content

Commit 8c5005c

Browse files
authored
Merge pull request #1810 from seleniumbase/linux-headed-mode
Fix headed mode on Linux and the log time offset
2 parents 2beac7d + 28dd7b4 commit 8c5005c

File tree

12 files changed

+53
-33
lines changed

12 files changed

+53
-33
lines changed

examples/tour_examples/bootstrap_google_tour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
class MyTourClass(BaseCase):
66
def test_google_tour(self):
77
self.open("https://google.com/ncr")
8-
self.wait_for_element('input[title="Search"]')
8+
self.wait_for_element('[title="Search"]')
99
self.hide_elements("iframe")
1010

1111
self.create_bootstrap_tour() # OR self.create_tour(theme="bootstrap")
1212
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
13-
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
13+
self.add_tour_step("Type in your query here.", '[title="Search"]')
1414
self.play_tour()
1515

16-
self.highlight_type('input[title="Search"]', "Google")
16+
self.highlight_type('[title="Search"]', "Google")
1717
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1818

1919
self.create_bootstrap_tour()
2020
self.add_tour_step("Then click to search.", '[value="Google Search"]')
2121
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2222
self.play_tour()
2323

24-
self.highlight_type('input[title="Search"]', "GitHub\n")
24+
self.highlight_type('[title="Search"]', "GitHub\n")
2525
self.ad_block()
2626
self.wait_for_element("#search")
2727

examples/tour_examples/google_tour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,17 @@
55
class MyTourClass(BaseCase):
66
def test_google_tour(self):
77
self.open("https://google.com/ncr")
8-
self.wait_for_element('input[title="Search"]')
8+
self.wait_for_element('[title="Search"]')
99
self.hide_elements("iframe")
1010

1111
# Create a website tour using the ShepherdJS library with "dark" theme
1212
# Same as: self.create_shepherd_tour(theme="dark")
1313
self.create_tour(theme="dark")
1414
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
15-
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
15+
self.add_tour_step("Type in your query here.", '[title="Search"]')
1616
self.play_tour()
1717

18-
self.highlight_type('input[title="Search"]', "Google")
18+
self.highlight_type('[title="Search"]', "Google")
1919
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
2020

2121
# Create a website tour using the ShepherdJS library with "light" theme
@@ -25,7 +25,7 @@ def test_google_tour(self):
2525
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2626
self.play_tour()
2727

28-
self.highlight_type('input[title="Search"]', "GitHub\n")
28+
self.highlight_type('[title="Search"]', "GitHub\n")
2929
self.ad_block()
3030
self.wait_for_element("#search")
3131

examples/tour_examples/hopscotch_google_tour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
class MyTourClass(BaseCase):
66
def test_google_tour(self):
77
self.open("https://google.com/ncr")
8-
self.wait_for_element('input[title="Search"]')
8+
self.wait_for_element('[title="Search"]')
99
self.hide_elements("iframe")
1010

1111
self.create_hopscotch_tour() # OR self.create_tour(theme="hopscotch")
1212
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
13-
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
13+
self.add_tour_step("Type in your query here.", '[title="Search"]')
1414
self.play_tour()
1515

16-
self.highlight_type('input[title="Search"]', "Google")
16+
self.highlight_type('[title="Search"]', "Google")
1717
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1818

1919
self.create_hopscotch_tour()
2020
self.add_tour_step("Then click to search.", '[value="Google Search"]')
2121
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2222
self.play_tour()
2323

24-
self.highlight_type('input[title="Search"]', "GitHub\n")
24+
self.highlight_type('[title="Search"]', "GitHub\n")
2525
self.ad_block()
2626
self.wait_for_element("#search")
2727

examples/tour_examples/introjs_google_tour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
class MyTourClass(BaseCase):
66
def test_google_tour(self):
77
self.open("https://google.com/ncr")
8-
self.wait_for_element('input[title="Search"]')
8+
self.wait_for_element('[title="Search"]')
99
self.hide_elements("iframe")
1010

1111
self.create_introjs_tour() # OR self.create_tour(theme="introjs")
1212
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
13-
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
13+
self.add_tour_step("Type in your query here.", '[title="Search"]')
1414
self.play_tour()
1515

16-
self.highlight_type('input[title="Search"]', "Google")
16+
self.highlight_type('[title="Search"]', "Google")
1717
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1818

1919
self.create_introjs_tour()
2020
self.add_tour_step("Then click to search.", '[value="Google Search"]')
2121
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2222
self.play_tour()
2323

24-
self.highlight_type('input[title="Search"]', "GitHub\n")
24+
self.highlight_type('[title="Search"]', "GitHub\n")
2525
self.ad_block()
2626
self.wait_for_element("#search")
2727

examples/tour_examples/shepherd_google_tour.py

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,23 @@
55
class MyTourClass(BaseCase):
66
def test_google_tour(self):
77
self.open("https://google.com/ncr")
8-
self.wait_for_element('input[title="Search"]')
8+
self.wait_for_element('[title="Search"]')
99
self.hide_elements("iframe")
1010

1111
self.create_shepherd_tour(theme="dark")
1212
self.add_tour_step("Welcome to Google!", title="SeleniumBase Tours")
13-
self.add_tour_step("Type in your query here.", 'input[title="Search"]')
13+
self.add_tour_step("Type in your query here.", '[title="Search"]')
1414
self.play_tour()
1515

16-
self.highlight_type('input[title="Search"]', "Google")
16+
self.highlight_type('[title="Search"]', "Google")
1717
self.wait_for_element('[role="listbox"]') # Wait for autocomplete
1818

1919
self.create_shepherd_tour(theme="light")
2020
self.add_tour_step("Then click to search.", '[value="Google Search"]')
2121
self.add_tour_step("Or press [ENTER] after entry.", '[title="Search"]')
2222
self.play_tour()
2323

24-
self.highlight_type('input[title="Search"]', "GitHub\n")
24+
self.highlight_type('[title="Search"]', "GitHub\n")
2525
self.ad_block()
2626
self.wait_for_element("#search")
2727

mkdocs_build/requirements.txt

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ lunr==0.6.2
2121
nltk==3.8.1
2222
tornado==6.2
2323
watchdog==2.3.1
24-
cairocffi==1.4.0
24+
cairocffi==1.5.0
2525
cairosvg==2.6.0
2626
cssselect2==0.7.0
2727
tinycss2==1.2.1

requirements.txt

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ attrs>=22.2.0;python_version>="3.7"
1717
PyYAML>=6.0
1818
certifi>=2022.12.7
1919
filelock>=3.4.1;python_version<"3.7"
20-
filelock>=3.9.1;python_version>="3.7"
20+
filelock>=3.10.0;python_version>="3.7"
2121
platformdirs>=2.4.0;python_version<"3.7"
2222
platformdirs>=3.1.1;python_version>="3.7"
2323
pyparsing>=3.0.7;python_version<"3.7"
@@ -102,7 +102,7 @@ rich==13.3.2;python_version>="3.7"
102102
# ("pip install -r requirements.txt" also installs this, but "pip install -e ." won't.)
103103

104104
coverage==6.2;python_version<"3.7"
105-
coverage==7.2.1;python_version>="3.7"
105+
coverage==7.2.2;python_version>="3.7"
106106
pytest-cov==4.0.0
107107
flake8==5.0.4;python_version<"3.9"
108108
flake8==6.0.0;python_version>="3.9"

seleniumbase/__version__.py

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,2 @@
11
# seleniumbase package
2-
__version__ = "4.13.14"
2+
__version__ = "4.13.15"

seleniumbase/core/log_helper.py

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -49,6 +49,7 @@ def get_master_time():
4949
timestamp = str(int(time.time())) + " (Unix Timestamp)"
5050
now = datetime.datetime.now()
5151
utc_offset = -time.timezone / 3600.0
52+
utc_offset += time.daylight
5253
utc_str = "UTC+0"
5354
if utc_offset > 0:
5455
if utc_offset < 10:

seleniumbase/fixtures/base_case.py

Lines changed: 22 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -407,7 +407,7 @@ def click(
407407
except Stale_Exception:
408408
self.wait_for_ready_state_complete()
409409
time.sleep(0.16)
410-
element = page_actions.wait_for_element_visible(
410+
element = page_actions.wait_for_element_clickable(
411411
self.driver,
412412
selector,
413413
by,
@@ -444,6 +444,22 @@ def click(
444444
timeout=timeout,
445445
original_selector=original_selector,
446446
)
447+
if not page_actions.is_element_clickable(
448+
self.driver, selector, by
449+
):
450+
try:
451+
self.wait_for_element_clickable(
452+
selector, by, timeout=1.8
453+
)
454+
except Exception:
455+
pass # Find out which element would get the click instead
456+
element = page_actions.wait_for_element_visible(
457+
self.driver,
458+
selector,
459+
by,
460+
timeout=timeout,
461+
original_selector=original_selector,
462+
)
447463
href = None
448464
new_tab = False
449465
onclick = None
@@ -500,7 +516,7 @@ def click(
500516
self.__jquery_click(selector, by=by)
501517
except Exception:
502518
# One more attempt to click on the element
503-
element = page_actions.wait_for_element_visible(
519+
element = page_actions.wait_for_element_clickable(
504520
self.driver,
505521
selector,
506522
by,
@@ -2748,7 +2764,7 @@ def __select_option(
27482764
)
27492765
try:
27502766
element = self.wait_for_element_clickable(
2751-
dropdown_selector, by=dropdown_by, timeout=1.2
2767+
dropdown_selector, by=dropdown_by, timeout=1.8
27522768
)
27532769
except Exception:
27542770
self.wait_for_ready_state_complete()
@@ -2775,7 +2791,7 @@ def __select_option(
27752791
)
27762792
try:
27772793
element = self.wait_for_element_clickable(
2778-
dropdown_selector, by=dropdown_by, timeout=1.2
2794+
dropdown_selector, by=dropdown_by, timeout=1.8
27792795
)
27802796
except Exception:
27812797
self.wait_for_ready_state_complete()
@@ -12121,7 +12137,7 @@ def __js_click(self, selector, by="css selector"):
1212112137
):
1212212138
try:
1212312139
self.wait_for_element_clickable(
12124-
selector, by, timeout=1.2
12140+
selector, by, timeout=1.8
1212512141
)
1212612142
except Exception:
1212712143
pass
@@ -12721,7 +12737,7 @@ def __activate_virtual_display_as_needed(self):
1272112737
"""Should be needed only on Linux.
1272212738
The "--xvfb" arg is still useful, as it prevents headless mode,
1272312739
which is the default mode on Linux unless using another arg."""
12724-
if "linux" in sys.platform:
12740+
if "linux" in sys.platform and (not self.headed or self.xvfb):
1272512741
width = settings.HEADLESS_START_WIDTH
1272612742
height = settings.HEADLESS_START_HEIGHT
1272712743
try:

0 commit comments

Comments
 (0)