How can I get the Web Element of new window?


#1

I’m using WorkFusion RPA Express ver. 1.4.0.
I have difficulty to get Web Elements of new window.
When I tried to get them, the following error occurred in RPAx: “Caused by: org.openqa.selenium.NoSuchElementException: Unable to find element with xpath == //*[@id=“NewPageText”]”

e.g.

OringPage.html
<html>
	<body>
		<script type="text/javascript">
			function openNewPage(){
				var features = "width=1280px,height=800px,"
					+ "center=yes,edge=sunken,resizable=yes,"
					+ "help=no,scrollbars=no,status=no,unadorned=no,location=no,toolbar=no,menubar=no";
				var newWindow = window.open("NewPage.html", "_blank", features);
			}
		</script>

		<label id="OriginPageText">OringText</label>
		<input type="button" id="OpenButton" value="OpenNew" onclick="openNewPage()" />
	</body>
</html>
NewPage.html
<html>
	<body>
		<label id="NewPageText">NewText</label>
	</body>
</html>

Actions Flow is

As a test, I changed the XPath of STEP 3 to “//*[@id=“OriginPageText”]”, then I could get the value of OriginPage.html correctly.
How can I get the Web Element of a new window using XPath?


#2

@y_ohkuboLhIveV does the bot open the new window at the second step? Could you share your recording here?


#3

@y_ohkuboLhIveV you can use custom actions to switch to a new tab. Try out these solutions: