Jesse Abucejo
Jesse Abucejo

Reputation: 67

Is there a way to retrieve text file values on the other machine in Eggplant?

I'm having a hard time reading text file from the other machine. I already tried to mapped the file like this \10.212.9.20\Eggplant\Test\propertyfile.txt. But it doesn't work. Here's my code:

set the itemDelimiter to "="
    repeat with theParams = each line of file "\\10.212.9.20\Eggplant\Test\propertyfile.txt"
    insert item 2 of theParams after myList
end repeat

put item 6 of myList into ServerURL
put item 10 of myList into Username
put item 9 of myList into Password

Thanks for the help.

Upvotes: 0

Views: 685

Answers (2)

user4839547
user4839547

Reputation: 11

"\10.212.9.20\Eggplant\Test\propertyfile.txt"

Are you running eggPlant on Windows? eggPlant Functional on Windows can only resolve letter-mapped drives, so if you map the shared drive to your eggPlant machine with a letter (i.e. D:\, E:) then you will be able to interact with the file saved on the other machine:

repeat with theParams = each line of file "D:\Eggplant\Test\propertyfile.txt"

Upvotes: 0

sphennings
sphennings

Reputation: 1083

If you are trying to open a file on the system you are testing you can have eggPlant open the file in a text editor and use ctrl+a ctrl+c to copy it's text into the clipboard. You can then parse this text similarly to if it were a file.

-- Assuming you have located the file and opened it in a text editor.
click(SomeLocationWithinTheTextEditor)
typeText ControlKey, "a" -- select all
typeText ControlKey, "c" -- copy to clipboard

set myTextFile = remoteClipboard(5) -- Wait up to 5 seconds to return the clipboard content

set the item delimiter to "="
repeat for each line of myTextFile
    insert item 2 of it after myList
end repeat

put item 6 of myList into ServerURL
put item 9 of myList into Password
put item 10 of myList into Username

Upvotes: 0

Related Questions