我在堆栈ASP MVC + AngularJS上有一个SPA应用程序,我想测试UI.现在我正在尝试使用PhantomJS和WebKit驱动程序的Selenium.
这是一个示例测试页面 - 具有单个元素的视图.列表项<li>从服务器动态加载,并由Angular限制.
<div id="items">
<li>text</li>
<li>text2</li>
</div>
Run Code Online (Sandbox Code Playgroud)
我正在尝试通过测试,并且此行中存在错误:
_driver.FindElements(By.TagName('li'))
Run Code Online (Sandbox Code Playgroud)
此时没有加载的元素,_driver.PageSource不包含元素.
我该如何等待加载项目?请不要建议Thread.Sleep()
我有一个 WebAPI(用 C# 编写)、一个接受带有名为TriggerDelay的 System.TimeSpan-Property 的复杂对象的 POST 方法,以及一个 React Native 应用程序,我从其中以 JSON 格式传递该对象。
但是,此 TimeSpan 属性未正确序列化,我不断在 API 端获取 00:00:00 值。
我正在尝试这样:
"triggerDelay":{
"hours": "30",
"minutes": "10",
"seconds": "0"
},
Run Code Online (Sandbox Code Playgroud)
或者像这样:
"triggerDelay": "30:10:00"
Run Code Online (Sandbox Code Playgroud)
但仍然没有运气......在 API 中,它始终是 00:00:00。
我将不胜感激任何帮助!
UPD这是我的模型:
"triggerDelay":{
"hours": "30",
"minutes": "10",
"seconds": "0"
},
Run Code Online (Sandbox Code Playgroud)
我的WebAPI方法:
public async Task<IActionResult> Publish([FromBody] Alarm alarm) {}
Run Code Online (Sandbox Code Playgroud)
这是我的原始 JSON 对象,在 Postman 的请求正文中设置:
{
"id": "d17ef748-f378-4728-c6c2-9dfab1efce5b",
[...other properties...]
"triggerDelay":{
"hours": "30",
"minutes": "10",
"seconds": "0"
}
}
Run Code Online (Sandbox Code Playgroud) 我需要将代理与 HtmlAgilityPack 一起使用。我给出了我的应用程序的链接RefURL。之后我希望应用程序从代理地址获取 url。例如“101.109.44.157:8080”
我搜索并发现了这个:
WebClient wc = new WebClient();
wc.Proxy = new WebProxy(host,port);
var page = wc.DownloadString(url);
Run Code Online (Sandbox Code Playgroud)
并像这样使用它。
RefURL = new Uri(refLink.Text);
WebClient wc = new WebClient();
wc.Proxy = new WebProxy("101.109.44.157:8080");
var page = wc.DownloadString(RefURL);
RefURL.ToString();
HtmlWeb web = new HtmlWeb();
HtmlAgilityPack.HtmlDocument doc = web.Load(RefURL.ToString());
Run Code Online (Sandbox Code Playgroud)
但它不起作用!
代码如下:
<p-table
[columns]="colsHistoryLogEntryList"
[value]="entity.historyLogEntryList"
[resizableColumns]="true"
[autoLayout]="true"
[paginator]="true"
[rows]="5"
[rowsPerPageOptions]="[5, 10, 25, 50, 100]"
paginatorDropdownAppendTo="body"
class="ui-table-historyEntry-list"
[rowHover]="true"
>
Run Code Online (Sandbox Code Playgroud)
当页面最大化时,下拉列表呈现到底部并且部分隐藏。但是当页面缩小时,它会正确地呈现为向上方向。
如何强制下拉列表始终可见?

先谢谢您的帮助。
这个问题似乎在其他地方被问过并得到回答,但我相信我已经尝试了所有这些解决方案,但未能取得真正的进展。
我正在尝试为 webdriverIO 创建一个自定义报告器。但是,当所有导入都运行时,我收到以下错误:
语法错误:无法在模块外部使用 import 语句
如果我尝试执行文件顶部的导入语句wdio.conf,则会出现上述错误import WebdriverTestrailsReporter。我可以通过使用 require 来解决这个问题,但是在import WDIOReporter from '@wdio/reporter'.
当我尝试添加"type": "module"到 package.json 时,出现新错误:
错误[ERR_REQUIRE_ESM]:必须使用导入加载ES模块:/Users/XXXXX/WebstormProjects/integration_test_framework/wdio.conf.local.js 不支持ES模块的require()。/Users/XXXXX/WebstormProjects/integration_test_framework/node_modules/@wdio/config/build/lib/ConfigParser.js 中的 /Users/XXXXX/WebstormProjects/integration_test_framework/wdio.conf.local.js 的 require() 是一个 ES 模块文件,如下所示它是一个 .js 文件,其最近的父 package.json 包含 "type": "module" ,它将该包范围内的所有 .js 文件定义为 ES 模块。相反,将 wdio.conf.local.js 重命名为以 .cjs 结尾,更改所需代码以使用 import(),或从 /Users/n1531435/WebstormProjects/integration_test_framework/package.json 中删除 "type": "module"。
使用 cjs 文件扩展名让我回到开始时出现的导入错误。我无法更改所需的代码,因为它存在于我的项目中WDIO ConfigParser,而不是我的项目中。
我还对 tsconfig 中的值进行了相当多的修改,包括目标值(es2015、es2017),但似乎没有任何效果。有任何想法吗?
据我了解,此设置中有 4 个相关文件。我将它们复制如下:
wdio相关文件片段:
wdio.conf.js
//const WebdriverTestrailsReporter = require('./src/test/ui/WebdriverTestrailsReporter.js'); …Run Code Online (Sandbox Code Playgroud) 我有 2 个项目,一个身份验证服务器和一个 API,但是当我尝试从 API 获取任何内容时,身份验证服务器总是返回
缺少必需的“token”参数
尽管它在我的机器上本地工作
使用 openiddict core 4.6 构建的身份验证服务器具有以下配置:
services.AddDbContext<AuthDbContext>(options =>
{
// Configure the context to use Microsoft SQL Server.
options.UseSqlServer(configuration.GetConnectionString("DefaultConnection"));
options.UseOpenIddict();
});
// Register the Identity services.
services.AddIdentity<ApplicationUser, IdentityRole>(options =>
{
options.User.RequireUniqueEmail = true;
}).AddDefaultUI()
.AddEntityFrameworkStores<AuthDbContext>()
.AddDefaultTokenProviders();
services.AddAuthentication()
.AddGoogle(options =>
{
IConfigurationSection googleAuthNSection =
configuration.GetSection("Authentication:Google");
options.ClientId = googleAuthNSection["AppId"];
options.ClientSecret = googleAuthNSection["AppSecret"];
})
.AddFacebook(options =>
{
IConfigurationSection FBAuthNSection =
configuration.GetSection("Authentication:Facebook");
options.ClientId = FBAuthNSection["AppId"];
options.ClientSecret = FBAuthNSection["AppSecret"];
})
.AddMicrosoftAccount(microsoftOptions =>
{
microsoftOptions.ClientId = configuration["Authentication:Microsoft:AppId"];
microsoftOptions.ClientSecret = …Run Code Online (Sandbox Code Playgroud) 我需要找到这个<a>标签驻留在一个FormView控件中,我需要根据条件删除这个标签,但我找不到它使用FormView.FindControl方法
<asp:UpdatePanel ID="upDiscipline" runat="server">
<ContentTemplate>
<asp:FormView ID="fvMediaIntro" runat="server">
<ItemTemplate>
<div class="clipControls">
<a runat="server" id="iNeedToFindThis" href="#">here</a>
</div>
</ItemTemplate>
</ContentTemplate>
</asp:UpdatePanel>
Run Code Online (Sandbox Code Playgroud)
我试过fvMediaIntro.FindControl()和fvMediaIntro.Row.FindControl(),既不工作.有什么想法吗?
我有一个 .Net 应用程序,其中我的一个页面在初始页面加载期间,我正在设置 asp 标签控件的文本。在我的 aspx 页面中,我有一个 Javascript 函数来读取标签文本并显示确认弹出消息。问题是,标签文本中的“\n”并没有在 JS 确认消息中引入换行符。
我的代码背后
lblMsg.Text = "string1" + "\n" + "string2"
Run Code Online (Sandbox Code Playgroud)
ASPX页面
function PendingDeleteValidate() {
var x = document.getElementById("<%=lblMsg.ClientID%>");
if (confirm(x.innerHTML))
return true;
else
return false;
}
Run Code Online (Sandbox Code Playgroud)
JS 确认对话框消息显示:
字符串1\n字符串2
我需要在两个字符串之间显示换行符。
我们网站上的数据很容易被删除.我们如何检测人类是在查看网站还是工具?
一种方法是计算用户在页面上停留的时间.我不知道如何实现这一点.任何人都可以帮助检测和阻止自动化工具从我的网站上抓取数据吗?
我在登录部分使用了安全图像,但即使这样,人类也可以登录然后使用自动化工具.当一段时间后重新显示图像时,用户可以键入安全图像并再次使用自动工具继续抓取数据.
我开发了一个刮刮另一个网站的工具.所以我只想阻止这种情况发生在我的网站上!
我想不出如何实现以下目标:
我需要将参数集合(或数组)传递给 Blazor 组件。传递的参数是 Blazor 组件。参数集合必须作为嵌套标签传递。必须能够分别调用每个传递的参数组件的渲染。
也就是说,我想要这样的东西:
<MyComponent>
<ParameterCollection>
<MyParameterComponent1>Caption1</MyParameterComponent1>
<MyParameterComponent2>Caption2</MyParameterComponent2>
<MyParameterComponent3>Caption3</MyParameterComponent3>
</ParameterCollection>
</MyComponent>
Run Code Online (Sandbox Code Playgroud)
我的组件代码:
@code{
[Parameter]
public RenderFragment[] ParameterCollection {get; set;} //Runtime error
}
Run Code Online (Sandbox Code Playgroud)
我想要得到的显然是在这里实现的商业 Blazor 组件(选择 VIEW SOURCE 选项卡)。GridColumns 参数被传递到 GridColumn 组件的集合。更准确地说,在我看来,它是它们对应的 RenderFragment 的集合。问题是它是如何完成的?
c# asp.net-core blazor blazor-server-side blazor-client-side
我有一个 CheckedListBox 和一个文本框。这里的目标是创建一个可搜索的 CheckedListBox。当我在 TextBox 中输入内容时,我必须过滤 CheckedListBox 中的项目。我编写了下面的代码来执行此操作,但是每次输入文本时,CheckedListBox 项目都会被清除,并且会出现新的过滤项目列表。这段代码的问题是过滤工作正常,但检查的项目每次都会被重置。
public partial class Form1 : Form
{
string[] elArray = {"Not Applicable" , "Aberdeen - Delivered" , "Belfast - Delivered" , "Birmingham - Delivered" , "Bournemouth - Delivered" , "Bradford - Delivered" , "Bristol - Delivered" , "Cambridge - Delivered" , "Canterbury - Delivered" , "OTHERS TO DE ADDED ..."};
public Form1()
{
InitializeComponent();
foreach (string elData in elArray)
{
resultBoxList.Items.Add(elData);
}
}
private void searchBox_TextChanged(object sender, EventArgs e)
{
resultBoxList.Items.Clear(); …Run Code Online (Sandbox Code Playgroud) 我正在网页上进行爬行练习,想要在我的网页上显示一些内容,但我陷入了寻找后代的代码中。以下是网页 HTML
<ul class="results">
<li class="gts" data-webm-section="OAG-AD-14960184">
<a class="item-link-container" href="/bikes/details/2016-Indian-Chieftain-Dark-Horse-MY17/OAG-AD-14960184/?cr=0&gts=OAG-AD-14960184&gtsviewtype=TopSpot&gtssaleid=OAG-AD-14960184&psq=%28%28Service%3D%5BBikesales%5D%26State%3D%5BNSW%5D%29%26%28%28%28%28SiloType%3D%5BBrand%20new%20bikes%20available%5D%7CSiloType%3D%5BBrand%20new%20bikes%20in%20stock%5D%29%7CSiloType%3D%5BDealer%20used%20bikes%5D%29%7CSiloType%3D%5BDemo%20%26%20near%20new%20bikes%5D%29%7CSiloType%3D%5BPrivate%20used%20bikes%5D%29%29&pso=0&pss=Premium">
<header>
<h3><span class=></span>Heading</h3>
<div class="spotlight flag non-textual">Spotlight</div>
</header>
<div class="primary panel">
<ul class="photos" data-js-lazy-load-length="3" style="width:8350px">
<li>
<img src="http//" height="221" width="334" alt="2016 Indian Chieftain Dark Horse MY17" />
</li>
</ul>
<div class="image-nav previous" data-webm-clickvalue="previous-image">
<span class="arrow"></span>
<span class="background"></span>
</div>
<div class="image-nav next" data-webm-clickvalue="next-image">
<span class="arrow"></span>
<span class="background"></span>
</div>
<div class="image-nav-count">
<span class="current">1</span> of 24
</div>
</div>
<div class="secondary panel">
<span class="price">$29,995*</span>
<div data-fancybox-href="/mvcajax/bikes/PriceGuide/" class="pricing-message light-box-iframe">
Ride Away No More To Pay …Run Code Online (Sandbox Code Playgroud) 我是MongoDB的新手,想知道如何计算从UTC时间12 AM到当前UTC时间每15分钟间隔插入集合中的文档总数。
以下是样本文件
{
"_id" : ObjectId("5ade8bfc6b941c7726a54f01"),
"Country" : "US"
"Timestamp" : ISODate("2018-04-24T01:44:28.040Z"),
}
Run Code Online (Sandbox Code Playgroud)
这是预期的输出:
{
"Count": 245,
"ReceiveDateString": "5/2/2018 12:00:00 AM"
},
{
"Count": 239,
"ReceiveDateString": "5/2/2018 12:15:00 AM"
},
{
"Count": 252,
"ReceiveDateString": "5/2/2018 12:30:00 AM"
},
{
"Count": 255,
"ReceiveDateString": "5/2/2018 12:45:00 AM"
},
{
"Count": 242,
"ReceiveDateString": "5/2/2018 1:00:00 AM"
}
.
.
.
and so on until current UTC time.
Run Code Online (Sandbox Code Playgroud)
我可以按分钟分组,如下所示:
var filter = Builders<Model>.Filter.Where(r => r.Timestamp > startDate && r.Timestamp < endDate);
var result …Run Code Online (Sandbox Code Playgroud) c# ×9
asp.net ×3
asp.net-core ×2
javascript ×2
angularjs ×1
append ×1
blazor ×1
c#-4.0 ×1
end-to-end ×1
findcontrol ×1
formview ×1
http-proxy ×1
linq ×1
mongodb ×1
node.js ×1
openiddict ×1
p-table ×1
pagination ×1
phantomjs ×1
primeng ×1
recaptcha ×1
selenium ×1
timespan ×1
typescript ×1
web-scraping ×1
webdriver-io ×1
winforms ×1
xpath ×1