如何将焦点转移到硒中没有名称、ID 或唯一标题的新弹出窗口
我想要获得焦点或选择一个单击链接时会弹出的窗口,并且该链接在 html 中具有以下标记,
<a target="_restaurant_50" href="/impersonate/50">View Dashboard</a>
如果我将窗口名称设置为 _restaurant_50,它会在 IDE 中出现以下错误
Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds.
我如何才能获得此窗口的焦点帮助... 我尝试了网上指定的所有方法,例如获取所有窗口*、按标题选择,但它仅给出父标题、webdriver PHP 切换窗口等。
数字 50
是根据数据库中的数字列表。
我在 PHP 中使用 selenium。
详情:
单击之前的数组名称
(
[0] => selenium_main_app_window
)
点击前的数组 ID
(
[0] =>未定义
)
单击后的数组名称
(
[0] => selenium_main_app_window
)
单击后的数组 ID
(
[0] =>未定义
)E
更新:
我尝试使用 openWindow("url",Windowname) 打开网址,点击后即可打开。它有效,但它打开一个新页面不遵循登录会话,它再次要求登录 提前致谢
I want to get focus or select an window which pop-up's on click to the link and the link has following tags in html
<a target="_restaurant_50" href="/impersonate/50">View Dashboard</a>
if i put window name as _restaurant_50 it gives the following error in IDE
Window does not exist. If this looks like a Selenium bug, make sure to read http://seleniumhq.org/docs/04_selenese_commands.html#alerts-popups-and-multiple-windows for potential workarounds.
How can i get the focus on this window please help...
I tried all the ways specified on net such as get all windows*, select by title but it gives the parent title only, webdriver PHP switch window, etc.
the number 50
is as per the number in database list.
I am using selenium with PHP.
Details:
Array Names before click
(
[0] => selenium_main_app_window
)
Array Ids before Click
(
[0] => undefined
)
Array Names After click
(
[0] => selenium_main_app_window
)
Array Ids After click
(
[0] => undefined
)E
Update:
I tried opening the url using openWindow("url",Windowname) which gets open on click. It worked but it opens a new page doesnt follow the logged in session it asks again for logging in
Thanks in Advance
我不熟悉 PHP selenium 驱动程序,但我使用 Java 执行此操作的方法是在单击之前获取窗口名称(或 ID)列表,执行单击,获取新列表并选择不存在的窗口前。请注意,有一个 selenium 命令可以获取所有已知的窗口名称和 id。
此外,如果问题只是从数据库生成的数字,您可以从链接获取目标属性,然后使用它来选择它打开的窗口。
I am not familiar with the PHP selenium drivers but the way I did this with Java was to get a list of Window Names (or IDs) before the click, perform the click, get the new list and select the window that wasn't there before. Note that there is a selenium command to get all known window names and ids.
Also, if the issue is just that the number is generated from the database, you could get the target attribute from the link, and then use that to select the window it opens.