Solved

Is there any way to dynamically switch browser in capture action?

  • 7 February 2024
  • 6 replies
  • 203 views

Badge +2

Hi,

We were thinking of optimizing the code by implementing multi browser compatibility in capture action. 

For example, during development I captured series of web action using chrome browser. Later due to some issues in chrome I want to switch to different browser (say for example edge). 

Is there anyway that we can dynamically pass certain params to capture action, without recapturing all the actions in edge browser?

I tired to do it, but the browser application & browser type properties are disabled / un editable. Please refer the snapshot below. 

Kindly let me know if there is way to achieve it.

Browser Application property is un editable
Browser Type property is un editable

 

icon

Best answer by Niyaz 7 February 2024, 07:51

View original

6 replies

Userlevel 2
Badge +10

There isn’t exactly a way to change the recorder properties on the go. The way I see it can be worked around is, having a try-catch block with Chrome set in try, and if that errors out in the catch close the chrome page if it is open and try opening with edge and continue the capture steps. 

Userlevel 4
Badge +14

There isn’t exactly a way to change the recorder properties on the go. The way I see it can be worked around is, having a try-catch block with Chrome set in try, and if that errors out in the catch close the chrome page if it is open and try opening with edge and continue the capture steps. 

Correct @spandana 4141 , further @Niyaz you can also check for window title / object exists or not using If/else conditions and basis that do the further processing. 

Userlevel 2
Badge +5

If you develop using Web Automation package, you can switch later between Edge and Chrome.

Badge +2

Hi @Zaid Chougle & @spandana 4141,

Thank you for the comments on it.

The thing is I don’t need my line of code grow longer because of recapturing the same actions again with other browsers in catch section.

So I tired a different way,

  1. In capture action, instead of using the Browser tab to capture the window’s to be automated I used Window tab. By doing so we get the window title with the browser name at the end.
  2. I replaced the entire browser name with wildcard (*). Below the snapshot shows (When selecting the capture window using Window tab)
  3. Now I launch the site using Open Browser action & choose browser as Chrome.

  4. The bot launch the site in chrome and completed all actions successfully.

  5. Then, in the Open Browser action, I just selected browser as Microsoft Edge.

  6. When I execute the bot without changing / recapture the other actions with other browsers, It worked!

For your reference, I attached the snapshot below (When selecting the capture window using Browser tab). 

Upon choosing this option we get the additional property as Browser Application which is not editable. When I run the bot just by changing the browser to Microsoft Edge, it is not working or throwing an error though it is locked to one particular browser.

Please share your comments if any. And let me know if it will work by trying it.

Badge +2

Hi @Zaid Chougle & @spandana 4141,

Thank you for the comments on it.

The thing is I don’t need my line of code grow longer because of recapturing the same actions again with other browsers in catch section.

So I tired a different way,

  1. In capture action, instead of using the Browser tab to capture the window’s to be automated I used Window tab. By doing so we get the window title with the browser name at the end.
  2. I replaced the entire browser name with wildcard (*). Below the snapshot shows (When selecting the capture window using Window tab)
  3. Now I launch the site using Open Browser action & choose browser as Chrome.

  4. The bot launch the site in chrome and completed all actions successfully.

  5. Then, in the Open Browser action, I just selected browser as Microsoft Edge.

  6. When I execute the bot without changing / recapture the other actions with other browsers, It worked!

For your reference, I attached the snapshot below (When selecting the capture window using Browser tab). 

Upon choosing this option we get the additional property as Browser Application which is not editable. When I run the bot just by changing the browser to Microsoft Edge, it is not working or throwing an error though it is locked to one particular browser.

Please share your comments if any. And let me know if it will work by trying it.

@Zaid Chougle / @spandana 4141 

Can you please share your comments if any on the solution I suggested?

Do you think of any possible issues / failure may occur in long run if we implement this?

Userlevel 4
Badge +14

Hi @Zaid Chougle & @spandana 4141,

Thank you for the comments on it.

The thing is I don’t need my line of code grow longer because of recapturing the same actions again with other browsers in catch section.

So I tired a different way,

  1. In capture action, instead of using the Browser tab to capture the window’s to be automated I used Window tab. By doing so we get the window title with the browser name at the end.
  2. I replaced the entire browser name with wildcard (*). Below the snapshot shows (When selecting the capture window using Window tab)
  3. Now I launch the site using Open Browser action & choose browser as Chrome.

  4. The bot launch the site in chrome and completed all actions successfully.

  5. Then, in the Open Browser action, I just selected browser as Microsoft Edge.

  6. When I execute the bot without changing / recapture the other actions with other browsers, It worked!

For your reference, I attached the snapshot below (When selecting the capture window using Browser tab). 

Upon choosing this option we get the additional property as Browser Application which is not editable. When I run the bot just by changing the browser to Microsoft Edge, it is not working or throwing an error though it is locked to one particular browser.

Please share your comments if any. And let me know if it will work by trying it.

@Zaid Chougle / @spandana 4141 

Can you please share your comments if any on the solution I suggested?

Do you think of any possible issues / failure may occur in long run if we implement this?

There might be an issue in the long run as the application is being captured in object properties.

 

Reply