File tree Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Expand file tree Collapse file tree 1 file changed +7
-0
lines changed Original file line number Diff line number Diff line change @@ -210,6 +210,13 @@ private function getCoordinates ($elementId)
210210 $ this ->webDriver ->executeScript ('jQuery.noConflict(); ' );
211211
212212 $ imageCoords = array ();
213+
214+ $ elementExists = (bool ) $ this ->webDriver ->executeScript ('return jQuery( " ' . $ elementId . '" ).length > 0; ' );
215+
216+ if ( !$ elementExists ) {
217+ throw new \Exception ("The element you want to examine (' " .$ elementId ."') was not found. " );
218+ }
219+
213220 $ imageCoords ['offset_x ' ] = (string ) $ this ->webDriver ->executeScript ('return jQuery( " ' . $ elementId . '" ).offset().left; ' );
214221 $ imageCoords ['offset_y ' ] = (string ) $ this ->webDriver ->executeScript ('return jQuery( " ' . $ elementId . '" ).offset().top; ' );
215222 $ imageCoords ['width ' ] = (string ) $ this ->webDriver ->executeScript ('return jQuery( " ' . $ elementId . '" ).width(); ' );
You can’t perform that action at this time.
0 commit comments