18 January 2026:


This forum is now archived and is in read-only mode. Please continue discussions on our improved new Sahi Pro Community forum.



Sahi Pro is an enterprise grade test automation platform which can automate web, mobile, API, windows and java based applications and SAP.

[Help] Different data brought up by different browsers in same web page.

wei_changwei_chang Members
edited September 2013 in Sahi - Open Source
Hi seniors:
sahi v4.4

I met a problem,
"In the same web page", to through IE9 to catch(a link), was showing _link(Edit). When uses another browser(Chrome 29.xx) to catch,
it was showing _link(EDIT), what's going on that ?
are there somebody experienced that? please share :) thanks in advance~

BR
Wei

Answers

  • Hi wei, Have you tried recording and playing back on the link element?
    Sahi can identify elements using plently of identifiers.
    Does using _link("Edit") or _link("EDIT") cause any problems while running the script?

    Regards.
  • SCKSCK Members
    hi wei_chang,

    Have encountered this issue some time back.
    Solution 1: Please make your script browser based. (eg : _isChrome(), _isIE())
    Solution 2 : Check for ui elements(e.g: id, name,label) other than _link which remains constant across the browsers and use that.
  • Hi Pratyush_Tyto
    Quoted:
    "Does using _link("Edit") or _link("EDIT") cause any problems while running the script?"

    Yes, it happened halt to go next stage while using _link("Edit") on Chrome browser(was catched _link("EDIT")).
    FYI

    BR
    Wei
  • wei_changwei_chang Members
    edited October 2013
    Hi SCK:

    Thanks for you replied,
    Quoted:
    "Solution 1: Please make your script browser based. (eg : _isChrome(), _isIE())"

    I don't know what that mean for,
    could you show me further detial for that? (or explain me more)

    BR
    Wei

  • Pratyush_TytoPratyush_Tyto Members
    edited October 2013
    Hi Wei,
    I agree with what Sarath Krishnan has suggested above.
    I think I understand what he suggested above and will try explaining what he meant.
    So, Sahi has APIs like isIE, isChrome, isFF etc what return true or false based on which browser you're running the script on.
    eg. isIE will return true for IE8, IE9, IE10 etc (all IE versions) and false for firefox, chrome etc.

    So as an example, to click the edit link your script should be something like this:
    ...
    ...
    ...
    if(isIE()) {
      _click(_link("Edit"));
    }
    else if(isChrome()) {
      _click(_link("EDIT"));
    }
    ...
    ...
    ...
    

    Please let me know if you need any further clarification in this matter.

    Regards.
  • Hi Pratyush_Tyto:

    wow, thanks sharing such good solution,
    It works very well.

    sincerely appreciating.
    BR
    Wei
  • Hi wei,
    Glad to help. :)
    I will be closing this discussion now.

    Regards.
This discussion has been closed.