Next Window popup

Is the pop-up window fully loaded at this time? If it not, add a timeout to the action.

Can you share your recording to have a look?

If you don’t want to share the recording on the forum, you can send it is a personal message.

If the way with getting handle doesn’t work, use this custom action to switch to the popup

@ashapkina i am unable to click on any web element after switching to the new tab in chrome. Could you please suggest and help to resolve.

What error do you get?
Please share your recording.

@ashapkina am sharing the screenshot,as i could not share the recording. It’s huge and has client information. The error says that : unable to locate the element.
image

There can be several reasons:

  • the XPath you use is incorrect
  • the element is located in an iFrame
  • use switch to the wrong window, etc.

First, make sure that the XPath is correct and that the element is not inside an iFrame.

@ashapkina

  1. i checked for xpath and it’s correct. Because when i tried to click the same web element in individual page it worked. so i conclude that xpath is correct and no iframe is attached to it.
  2. The window handle for the page is also correct which i am using to switch to the window.

Steps i follwed:

  1. i have a main url from where i am picking up 2 links/href.
  2. Using the keyboard action(Ctrl+T) i have opened new tab and pasted the link to open it.
    3.Once the page gets open i have used cutom script to switch to the window.
    4.When i am trying to click on the webelement, it is giving me error as No such element found.

Please suggest, i am stuck into this issue since many days.
Thanks

Can you share your custom script code?

@ashapkina
@CustomScriptAction(
input=[‘window_title’]

)

def customScript() {
switchTo().window("${window_title}")
switchTo().defaultContent()
}

window_title is the windowhandle obtained using driver().getWindowHandle().

Is this the second Custom script in the flow above (step 719)?
Then what does the fist script do (step 717)?

i have removed the first custom script now and using only one custom script which i have shared just now.

I think that the Constant value action might read the handle of the previous window (the one that is active at that moment), not the one you open in the new tab.

Why don’t you use the switchToNextWindow() here?

After you open the new tab, press Enter and wait for the window to load, use this custom action to switch to it

@CustomScriptAction(
)

def customScript() {
   switchToNextWindow()
}

and then use the mouse click and web actions in the new window.

i made the changes as per your suggestion, still did not work!!

@shivangee_sunX can you share the actions flow you have now?

Do you use Chrome or another browser?

Try running these samples in Studio. Do they run correctly?

Also, is it important to keep the original web page open all the time?
Can you open the links that you read on the page using Open website action instead of opening them in new browsers?

@ashapkina, i tried with both the examples. They are working fine. Let me debug my code and get back to you:)

1 Like