title: Xpath is invalid: TypeError: The expression cannot be converted to return the specified type
body: <p>I am using selenium using Robot Framework I'm getting </p>
  
  <pre><code>xpath is invalid: TypeError: The expression cannot be converted to return the specified type.
  </code></pre>
  
  <p>The code I used is </p>
  
  <pre><code>Set Test Variable                                 ${xpathIP}              xpath=//ul/li/div[@class="segmentName"]
  ${IPSegmentsCnt}=    Get Matching Xpath Count     ${xpathIP}
  Log     ${IPSegmentsCnt}
  :For        ${i}    IN RANGE    1    ${IPSegmentsCnt} + 1
   \    ${name}=      Get Text         xpath=(${xpathIP})[${i}]
   \     Log          ${name}
   \    Should Not Match Regexp        ${name}            \\(DS:.+\\)
  </code></pre>
  
  <p>I'm not getting what exactly the error is...</p>
  
  <p>HTML:</p>
  
  <p><div class="snippet" data-lang="js" data-hide="false" data-console="true" data-babel="false">
  <div class="snippet-code">
  <pre class="snippet-code-html lang-html prettyprint-override"><code>&lt;li _ngcontent-ats-90=""&gt;
      &lt;span _ngcontent-ats-90="" ng-reflect-class-name="arrow collapse-false" class="arrow collapse-false"&gt;&lt;/span&gt;
      
  &lt;md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4INFO IP Segments"&gt;&lt;label class="mat-checkbox-layout"&gt;&lt;div class="mat-checkbox-inner-container"&gt;&lt;input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-1" id="input-md-checkbox-1" ng-reflect-name="4INFO IP Segments" name="4INFO IP Segments" tabindex="0" aria-label=""&gt;
      &lt;div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-frame"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-background"&gt;&lt;svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"&gt;&lt;path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;div class="mat-checkbox-mixedmark"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="mat-checkbox-label"&gt;
      &lt;/span&gt;&lt;/label&gt;&lt;/md-checkbox&gt;
      &lt;div _ngcontent-ats-90="" class="datasourceName"&gt;4INFO IP Segments  false&lt;/div&gt;
      &lt;ul _ngcontent-ats-90=""&gt;
          &lt;li _ngcontent-ats-90=""&gt;
              &lt;md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4Info_Age_18-30"&gt;&lt;label class="mat-checkbox-layout"&gt;&lt;div class="mat-checkbox-inner-container"&gt;&lt;input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-2" id="input-md-checkbox-2" ng-reflect-name="4Info_Age_18-30" name="4Info_Age_18-30" tabindex="0" aria-label=""&gt;&lt;div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-frame"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-background"&gt;&lt;svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"&gt;&lt;path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;div class="mat-checkbox-mixedmark"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="mat-checkbox-label"&gt;
              &lt;/span&gt;&lt;/label&gt;&lt;/md-checkbox&gt;
              &lt;div _ngcontent-ats-90="" class="segmentName"&gt;4Info_Age_18-30 (DS: 0) (CPM: $1.00)&lt;/div&gt;
          &lt;/li&gt;&lt;li _ngcontent-ats-90=""&gt;
             &lt;md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4Info_Age_35_and_over"&gt;&lt;label class="mat-checkbox-layout"&gt;&lt;div class="mat-checkbox-inner-container"&gt;&lt;input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-3" id="input-md-checkbox-3" ng-reflect-name="4Info_Age_35_and_over" name="4Info_Age_35_and_over" tabindex="0" aria-label=""&gt;&lt;div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-frame"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-background"&gt;&lt;svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"&gt;&lt;path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;div class="mat-checkbox-mixedmark"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="mat-checkbox-label"&gt;
              &lt;/span&gt;&lt;/label&gt;&lt;/md-checkbox&gt;
              &lt;div _ngcontent-ats-90="" class="segmentName"&gt;4Info_Age_35_and_over (DS: 0) (CPM: $1.00)&lt;/div&gt;
          &lt;/li&gt;&lt;li _ngcontent-ats-90=""&gt;
              &lt;md-checkbox _ngcontent-ats-90="" class="mat-accent mat-checkbox ng-untouched ng-pristine ng-valid" ng-reflect-name="4Info_Age_50_plus"&gt;&lt;label class="mat-checkbox-layout"&gt;&lt;div class="mat-checkbox-inner-container"&gt;&lt;input class="mat-checkbox-input cdk-visually-hidden" type="checkbox" ng-reflect-id="input-md-checkbox-4" id="input-md-checkbox-4" ng-reflect-name="4Info_Age_50_plus" name="4Info_Age_50_plus" tabindex="0" aria-label=""&gt;&lt;div class="mat-checkbox-ripple mat-ripple" md-ripple="" ng-reflect-trigger="[object HTMLElement]" ng-reflect-centered="true" ng-reflect-speed-factor="0.3"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-frame"&gt;&lt;/div&gt;&lt;div class="mat-checkbox-background"&gt;&lt;svg xml:space="preserve" class="mat-checkbox-checkmark" version="1.1" viewBox="0 0 24 24" xmlns="http://www.w3.org/2000/svg"&gt;&lt;path class="mat-checkbox-checkmark-path" d="M4.1,12.7 9,17.6 20.3,6.3" fill="none" stroke="white"&gt;&lt;/path&gt;&lt;/svg&gt;&lt;div class="mat-checkbox-mixedmark"&gt;&lt;/div&gt;&lt;/div&gt;&lt;/div&gt;&lt;span class="mat-checkbox-label"&gt;
              &lt;/span&gt;&lt;/label&gt;&lt;/md-checkbox&gt;
              &lt;div _ngcontent-ats-90="" class="segmentName"&gt;4Info_Age_50_plus (DS: 0) (CPM: $1.00)&lt;/div&gt;
          &lt;/li&gt;&lt;li _ngcontent-ats-90=""&gt;
              
      &lt;/ul&gt;
  &lt;/li&gt;</code></pre>
  </div>
  </div>
  </p>
  
  <p>I tried multiple times that wasn't worked</p>