Answered

How to save page source value in a variable

Case: To make the code independent and reduce the code size I want to implement below functionality
1. Every time when my test run I want to search the data(for eg. already created course) in the system and continue the rest of the cases with that. This will come under "If" statement
2. In case no data is present inside the system then I will create a new data and then my next test cases will proceed. This will come under "Else" statement
Query: I am right now struck on first step where I want to store the page source value in a variable

0
4 comments
Avatar
Joseph Hamdan

+Moving to feature requests

Hi Joel,

Currently, Print_Page_Source command is used to retrieve the source code from a page, but it does not support variables yet. We have moved your question into a feature request in order to send updates when this gets implemented in a future release.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Joel,

We found a workaround using Javascript that can be done as follows:

1- Define a step with Get_Web_Value and click Javascript source type

2- In the Script box, add the below for inner or outer HTML

return document.documentElement.outerHTML
return document.documentElement.innerHTML

3- Assign a variable name and run test case to check result

Please let us know if this does not work or if you have other issues we can assist with. We can set up a call if needed.

Regards,
Subject7 Team

0
Comment actions Permalink
Avatar
Joel Sequeira

Hi Joseph

I have tried from java script but did not get the required page source but I got from "Print_page_source" command .
Can you please help me to save printed value of page source in any variable so that I can compare my text from that.

Thanks
Regards
Joel

 

0
Comment actions Permalink
Avatar
Joseph Hamdan

Hi Joel,

Is there a test case I can look at to investigate this?

Thank you!

Regards,
Subject7 Team

0
Comment actions Permalink

Please sign in to leave a comment.