@@ -579,7 +579,7 @@ public function getValue($xpath)
579579 {
580580 $ element = $ this ->findElement ($ xpath );
581581 $ elementName = strtolower ($ element ->name ());
582- $ elementType = strtolower ($ element ->attribute ('type ' ));
582+ $ elementType = strtolower ($ element ->attribute ('type ' ) ?: '' );
583583
584584 // Getting the value of a checkbox returns its value if selected.
585585 if ('input ' === $ elementName && 'checkbox ' === $ elementType ) {
@@ -657,7 +657,7 @@ public function setValue($xpath, $value)
657657 }
658658
659659 if ('input ' === $ elementName ) {
660- $ elementType = strtolower ($ element ->attribute ('type ' ));
660+ $ elementType = strtolower ($ element ->attribute ('type ' ) ?: '' );
661661
662662 if (in_array ($ elementType , array ('submit ' , 'image ' , 'button ' , 'reset ' ))) {
663663 throw new DriverException (sprintf ('Impossible to set value an element with XPath "%s" as it is not a select, textarea or textbox ' , $ xpath ));
@@ -756,7 +756,7 @@ public function selectOption($xpath, $value, $multiple = false)
756756 $ element = $ this ->findElement ($ xpath );
757757 $ tagName = strtolower ($ element ->name ());
758758
759- if ('input ' === $ tagName && 'radio ' === strtolower ($ element ->attribute ('type ' ))) {
759+ if ('input ' === $ tagName && 'radio ' === strtolower ($ element ->attribute ('type ' ) ?: '' )) {
760760 $ this ->selectRadioValue ($ element , $ value );
761761
762762 return ;
@@ -1144,7 +1144,7 @@ private function deselectAllOptions(Element $element)
11441144 */
11451145 private function ensureInputType (Element $ element , $ xpath , $ type , $ action )
11461146 {
1147- if ('input ' !== strtolower ($ element ->name ()) || $ type !== strtolower ($ element ->attribute ('type ' ))) {
1147+ if ('input ' !== strtolower ($ element ->name ()) || $ type !== strtolower ($ element ->attribute ('type ' ) ?: '' )) {
11481148 $ message = 'Impossible to %s the element with XPath "%s" as it is not a %s input ' ;
11491149
11501150 throw new DriverException (sprintf ($ message , $ action , $ xpath , $ type ));
0 commit comments