0

After clicking on Edit, a new page appears. I want to read a few data from that opened page. I used GET Value with locator to fetch id value.

Id has 4 values

  1. New
  2. Open
  3. In progress
  4. Close

where --Select-- is field watermark or placeholder

After clicking on edit, I could see the value of id in UI is 'In progress'

${Id}=Get Value//label[@for='Id']/following-sibling::div/div/div/div[1]
Log To Consoleid ${Id}  

console output :-

id -- Select --

I intend to get the correct value 'In progress' from UI. However it is not fetching the correct value, its showing --Select--.

Element in UI:-

<li class="grid__col-x required" style="display: flex;"> ==$0
::before
<label for="Id">Id</label>   
<div class="css-18asa text-input react-select--is-disabled">
    <div class="css-g9sas react-select__control react-select__control--is-disabled">
         <div class="css-asas react-select__value-container react-select__value-container--has-value">
              <div class="css-212wew react-select__single-value react-select__single-value--is-disabled">In Progress</div>
              <div class="css-rsyb7x">
  • Use get text , get value gets the information from that value attribute i – PDHide Mar 5 at 7:34
  • I tried with both Get text and Get value... It did not fetch the value. – sneha Mar 5 at 7:53
1

Get Value, returns the content of the 'value' attribute.

Use Get Text instead

*** Settings ***
Documentation   This is the script for Create Sales Visit Repository
Library     SeleniumLibrary

*** Test Cases ***

Input Text
    Open Browser    file:///D:/testout.html    chrome
    Wait Until Page Contains Element        xpath://*[contains(text(),"In Progress")]
    ${Id}=    Get Text    //*[contains(text(),"In Progress")]
    Log To Console    ${Id}    

Output

enter image description here

| improve this answer | |
  • I tried this also. It returned --Select--, whereas in UI, it was 'In progress' – sneha Mar 5 at 8:00
  • @sneha for get Text you got select ? try using wait before fetching the data – PDHide Mar 5 at 8:02
  • @see the updated answer – PDHide Mar 5 at 8:08
  • @sneha make sure you are using correct locator – PDHide Mar 5 at 8:19
  • I used Wait until element is visible, it was fetching the elements properly where drop down is not there. – sneha Mar 5 at 8:59

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service, privacy policy and cookie policy

Not the answer you're looking for? Browse other questions tagged or ask your own question.