Reputation: 282
I am trying to get dynamic text from the web page using the sahi pro script. I used following script to get the text.
_setValue(_textbox("j_username"), "******");
_setValue(_password("j_password"), "*****");
_click(_span("Login"));
_click(_span("Home"));
var $date = _getText(_div("/bwc-selected/"));
var $number = parseInt(_extract($date, "/(.*)bwc-selected/", true));
The html code display as below:
<div class="date-display 20170301 bwc-selected">Wednesday 01 Mar 2017</div>
Here, in the above html code I need to get the dynamic date "20170301" or "Wednesday 01 Mar 2017"
no luck till now.
Upvotes: -1
Views: 342
Reputation: 282
I updated my code as below and I am able to extract the date:
_setValue(_textbox("j_username"), "*****");
_setValue(_password("j_password"), "*****");
_click(_span("Login"));
_click(_span("Home"));
_wait(2000);
var $date = _getText(_div("/date-display .* bwc-selected/"));
_wait(2000);
_log($date);
Upvotes: 0
Reputation: 767
You get the "Wednesday 01 Mar 2017" part with _getText(_div("/bwc-selected/"));
just fine. For the "20170301" part, use _div("/bwc-selected/").className
Upvotes: 0