English 中文(简体)
采用Selenium for在C#的超文本档案中找到内容的问题
原标题:Problem Using Selenium for Chrome to find element in HTML file with C#

我正在利用Selenium在 Chromebrowser内部展示的超文本文件中找到内容。 超文本不属我,似乎存在许多问题。 我没有能力改变这一代人,我只得与我的工作合作。

Here is a snippet of the HTML for an element I am trying to find from its text ">General Lease Legal Information"

<div class="TableTitlebar HeaderedTableTitlebar">
<div class="FastTitlebar">
<div class="FastTitlebarCaptionWrapper">
<h3 id="caption2_Dd-53" class=" FastTitlebarCaption">General Lease Legal Information</h3>
</div>

在一个非常令人迷惑的建筑中,这一水平是很深的。 我已尝试了FindElement的不同搜索标准。 我总是没有发现错误。

最大的问题是,产生这一超文本的网址,在新上一页时,将经常更新内容的识别资料。 因此,使用身份证搜查最终将中断。 等同类别名称的属性只是重复工地,没有稳定地使工地成为工地。

Here is how to get to the webpage. Open a browser and go to: https://oktap.tax.ok.gov/OkTAP/web?link=PUBLICPUNLKP

Select the radio button for "Search By PUN:" Enter the value "029-123551-0-0000" Scroll to the bottom of the page and select the "Search" button. Just above the Search button will be a line of text with "029-123551-0-0000" highlighted on the far left. Select this link. On the new page, select the "Printable" tab on the right side of the menu bar. On the new page, scroll down to find the table for General Lease Legal Information.

由于超文本中的说明如此之差,因此找到下表要素的唯一途径是,我没有硬拷贝,就寻求在登出的“超文本不适用”中寻找标题案文,然后在后面寻找第一个表要素。

这确实是一件大事。 我不相信,由于超文本的施工情况不佳,网站是可拆卸的。 我正在使用C#,因为这是我本人和我公司的其他方案家的熟练程度。 我愿意就如何找到理想的要素以及重新设计整个应用提出建议。

问题回答

你可以做一些事情,如增加你自己在测试电象时可以寻求的习俗属性。

<h3 id="caption2_Dd-53" class="FastTitlebarCaption" data-automated-testing="your-general-lease-test-automation-id">General Lease Legal Information</h3>

document.querySelector( h3[data-automated-testing="your-general-lease-test-automation-id"] )

您可以称之为习俗,认为你只想用“数据”——





相关问题
Anyone feel like passing it forward?

I m the only developer in my company, and am getting along well as an autodidact, but I know I m missing out on the education one gets from working with and having code reviewed by more senior devs. ...

NSArray s, Primitive types and Boxing Oh My!

I m pretty new to the Objective-C world and I have a long history with .net/C# so naturally I m inclined to use my C# wits. Now here s the question: I feel really inclined to create some type of ...

C# Marshal / Pinvoke CBitmap?

I cannot figure out how to marshal a C++ CBitmap to a C# Bitmap or Image class. My import looks like this: [DllImport(@"test.dll", CharSet = CharSet.Unicode)] public static extern IntPtr ...

How to Use Ghostscript DLL to convert PDF to PDF/A

How to user GhostScript DLL to convert PDF to PDF/A. I know I kind of have to call the exported function of gsdll32.dll whose name is gsapi_init_with_args, but how do i pass the right arguments? BTW, ...

Linqy no matchy

Maybe it s something I m doing wrong. I m just learning Linq because I m bored. And so far so good. I made a little program and it basically just outputs all matches (foreach) into a label control. ...

热门标签