如何获得动态着陆页标题并等待加载该目标网页? [英] How does one get a dynamic landing page title and wait for that landing page to load?

查看:46
本文介绍了如何获得动态着陆页标题并等待加载该目标网页?的处理方法,对大家解决问题具有一定的参考价值,需要的朋友们下面随着小编来一起学习吧!

问题描述

大家好

以下是我的方案:

1)我正在登录我的应用程序,应用程序登录页面是动态的我事先并不知道哪个页面将成为我的目标网页。页面标题完全是随机的,例如:工作队列分配,调度板等等。所以这不是
一个字符串被修复而另一个字符串正在变化的情况。

1) I am logging in to my application and application landing page is dynamic and I do not know in advance that which page will be my landing page. Page title is totally random like: Work Queue Assignments, Scheduling Board etc. so this is not the case where one string is fixed and another is changing.

2)我想应用一个等待方法,以便在执行下一个语句之前可以正确加载浏览器。我该如何应用呢?

2) I want to apply a wait method so that Browser can load properly before executing the next statement. How can I apply this?

3)我想捕获浏览器标题,但我不知道如何捕获它?

3) I want to capture the browser title but I do not know how can I capture it?

我是使用以下代码:

BrowserWindow sBrowser = BrowserWindow.Launch(new System.Uri(< Application URL>));

BrowserWindow sBrowser = BrowserWindow.Launch(new System.Uri(<Application URL>));

登录声明;

sBrowser.WaitForControlReady(); //这不起作用,因为sBrowser对象包含登录页面的标题

sBrowser.WaitForControlReady();//This will not work as sBrowser object contain title of login page

sBrowser = BrowserWindow.Locate(" Scheduling)板"); //但是页面标题没有修复,它可以有其他值,如工作队列分配等。

sBrowser = BrowserWindow.Locate("Scheduling Board"); //But page title is not fixed it can have other values like work queue assignments etc.

string sPageTitle = sBrowser.Title;

string sPageTitle = sBrowser.Title;

上面的代码失败,因为Locate方法总是会失败,因为登陆页面没有修复。

above code is failing as Locate method will always fail because landing page is not fixed.

我有什么方法可以在运行时获取浏览器对象,记住我不知道名字提前浏览器对象的属性。之前我使用过RFT,并且有一个Root Object功能,可以在运行时捕获所需的
浏览器对象。

Is there any way by which I can get browser object in run time keeping in mind that I do not know the Name property of the browser object in advance. I used RFT before and there is Root Object feature there with the help of that one can capture the desired browser object at run time.

谢谢

The Ghost

The Ghost

推荐答案

嗨苏丹,

我认为你可以使用WindowHandle要动态设置Browser属性,请查看下面给出的示例

I think you can use WindowHandle to set the the Browser property dynamically , look at the example given below

//Launching the browser with URLBrowserWindow sBrowser = BrowserWindow.Launch(new System.Uri("http://gmail.com"));//Getting the Window Handle and assigning it to the Browser instancesBrowser.SearchProperties.Add("WindowHandle", sBrowser.WindowHandle.ToString());//Getting the Browser Titlestring title = sBrowser.Title;





这篇关于如何获得动态着陆页标题并等待加载该目标网页?的文章就介绍到这了,希望我们推荐的答案对大家有所帮助,也希望大家多多支持IT屋!

查看全文
登录 关闭
扫码关注1秒登录
发送“验证码”获取 | 15天全站免登陆