我正在使用Selenium开发一个小型控制台应用程序,我需要关闭它的所有日志.
我试过phantomJSDriver.setLogLevel(Level.OFF);但它不起作用.我需要帮助.
如何禁用使用Selenium和Phantomjs(GhostDriver)的控制台应用程序中的所有日志?
我在使用 xpath 时遇到问题。我需要从类别中选择所有项目。类似于(伪语言):如果class != block-events-head且父属性data-category-sport="Basketball",则选择所有 div
这是 html 示例:
<div data-category-sport="Basketball" data-category-treeid="972911">
<div class="block-events-head">...</div>
<div id="event_1558960" data-event-treeid="1558960">...</div>
<div id="event_1559240" data-event-treeid="1559240">...</div>
<div id="event_1559560" data-event-treeid="1559560">...</div>
</div>
Run Code Online (Sandbox Code Playgroud)
我想:
.//div[@class!="block-events-head" and ../div[@data-category-sport='Basketball']]
Run Code Online (Sandbox Code Playgroud)
但它不起作用:(
.//div[@class!="block-events-head"]
Run Code Online (Sandbox Code Playgroud)
可行,但如何添加“按父级过滤器”?
请帮我解决一下..
问候!
我已经使用PhantomJs将大型JS项目转换为打字稿(作为IC#程序员).问题是解释器(phantomjs)在执行此js文件时失败.
D:\My\phantomjs-1.9.7-windows\phantomjs.exe --load-images=false --ssl-protocol=any --web-security=no --cookies-file=cookies C:\Users\alex\Projects\robot\bo.js
TypeError: 'undefined' is not an object (evaluating 'b.prototype')
Run Code Online (Sandbox Code Playgroud)
代码是:
var __extends = this.__extends || function (d, b) {
for (var p in b) if (b.hasOwnProperty(p)) d[p] = b[p]
function __() { this.constructor = d; }
__.prototype = b.prototype; // <<< here
d.prototype = new __();
};
Run Code Online (Sandbox Code Playgroud)
所以.我认为这个问题与继承有一定关系.有没有人遇到过这个问题?任何帮助表示赞赏.谢谢.
我有一个应用程序有一些控件(按钮、编辑等)的窗口。我需要模拟用户事件(如 Tab 单击和输入文本)。我用来keybd_event在选项卡排序控件(编辑框)和输入文本之间移动焦点。但我需要知道当前焦点控件的句柄(例如从中获取文本或更改其样式)。我该如何解决?
ps我现在正在写Delphi,但这并不重要(Win-API到处都一样)。
If I need one handle some event I usually code like this:
// part of browser
UrlEventHandler docReadyDelegate = null;
var documentReady = new UrlEventHandler((sender, args) =>
{
view.DocumentReady -= docReadyDelegate; // unsubscribe
// some code here. Fired then browser's document is ready!
});
docReadyDelegate = documentReady;
view.DocumentReady += docReadyDelegate; // subscribe
view.Navigate("http://google.com");
Run Code Online (Sandbox Code Playgroud)
But as I think its not optimally and not beautiful. I know it possible to use Reactive Extensions to handle event once. How?
我有一个字符串fcsNotificationZK44_0376300009215000019_4158794.xml和一个模式(fcs.*)_,目标是获得fcsNotificationZK44但标准C#Regex匹配fcsNotificationZK44_0376300009215000019因为它是贪婪的.在javascript中我可以使用/U修饰符打开ungreedy模式,但如何在C#中解决它Regex?谢谢.
我需要将一个WinForms表单(with BorderStyle = None)嵌入到Inno安装向导中并出现问题.
这是一个Inno安装脚本:
procedure EmbedConfiguratorForm(parentWnd: HWND);
external 'EmbedConfiguratorForm@files:configurator.dll stdcall';
procedure InitializeWizard();
var
cfgPageHandle: HWND;
begin
cfgPageHandle := CreateCustomPage(wpSelectDir,
'Configuration',
ExpandConstant(description)).Surface.Handle;
EmbedConfiguratorForm(cfgPageHandle);
end;
Run Code Online (Sandbox Code Playgroud)
这是一个C#代码:
class WizardWindow : IWin32Window
{
public WizardWindow(IntPtr handle)
{
Handle = handle;
}
public WizardWindow(int handle) : this(new IntPtr(handle))
{
}
public IntPtr Handle { get; private set; }
}
public static class MainClass
{
[DllExport("EmbedConfiguratorForm", CallingConvention.StdCall)]
public static void EmbedConfiguratorForm(int parentWnd)
{
// System.Diagnostics.Debugger.Launch();
ConfiguratorForm form = new ConfiguratorForm();
form.Show(new WizardWindow(parentWnd));
}
} …Run Code Online (Sandbox Code Playgroud) c# ×2
c ×1
c#-4.0 ×1
c++ ×1
delphi ×1
dom ×1
ghostdriver ×1
html ×1
inno-setup ×1
java ×1
javascript ×1
phantomjs ×1
regex ×1
regex-greedy ×1
typescript ×1
windows ×1
winforms ×1
xpath ×1