File tree Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Expand file tree Collapse file tree 1 file changed +19
-14
lines changed Original file line number Diff line number Diff line change 1515/**
1616 * Trait ElementIsVisibleTrait Based on the blog post below
1717 *
18- * @see https://maslosoft.com/blog/2018/04/04/codeception-acceptance-check-if-element-is-visible/
18+ * @see https://maslosoft.com/blog/2018/04/04/codeception-acceptance-check-if-element-is-visible/
19+ * @since 4.0
1920 */
20- trait ElementIsVisibleTrait {
21-
21+ trait ElementIsVisibleTrait
22+ {
2223 /**
2324 * Checks if an element is visible on the page
2425 *
2526 * @param string $element The element to check if it's visible
2627 *
27- * @return bool
28+ * @return boolean
2829 */
2930 public function haveVisible ($ element )
3031 {
32+ // phpcs:disable
3133 /** @var \Codeception\Actor $I */
3234 $ I = $ this ;
3335 $ value = false ;
34- $ I ->executeInSelenium (function (RemoteWebDriver $ webDriver )use ($ element , &$ value )
35- {
36- try
37- {
38- $ element = $ webDriver ->findElement (WebDriverBy::cssSelector ($ element ));
39- $ value = $ element instanceof RemoteWebElement;
40- }
41- catch (\Exception $ e )
36+ $ I ->executeInSelenium (function (RemoteWebDriver $ webDriver ) use ($ element , &$ value )
4237 {
43- // Swallow exception silently
38+ try
39+ {
40+ $ element = $ webDriver ->findElement (WebDriverBy::cssSelector ($ element ));
41+ $ value = $ element instanceof RemoteWebElement;
42+ }
43+ catch (\Exception $ e )
44+ {
45+ // Swallow exception silently
46+ }
4447 }
45- });
48+ );
49+ // phpcs:enable
50+
4651 return $ value ;
4752 }
4853}
You can’t perform that action at this time.
0 commit comments