我正在尝试设置远程webdriver以在远程计算机上运行我的测试,因为我的应用程序已部署到我的localhost.使用Selenium RC我使用主机地址来运行这些测试,它运行良好; 但是我在使用远程webdriver设置基类时遇到了麻烦.我已经尝试了以下代码,但它没有奏效.顺便说一句,我有selenium测试,我正在迁移到远程webdriver.我试过webdriver工作正常,但无法设置远程webdriver进行远程执行.任何帮助将不胜感激.
public static String base_url = "http://localhost:8084";
Proxy proxy = new Proxy();
proxy.setProxyAutoconfigUrl(base_url);
DesiredCapabilities capabilities = DesiredCapabilities.internetExplorer();
capabilities.setCapability(CapabilityType.PROXY, proxy);
RemoteWebDriver driver = new RemoteWebDriver(capabilities);
selenium = new WebDriverBackedSelenium(driver, base_url);
Run Code Online (Sandbox Code Playgroud)
示例网格2代码适用于Firefox,但不适用于IE9
String hubURL = "http://myip:4444/wd/hub";
DesiredCapabilities capability = DesiredCapabilities.internetExplorer();
//capability.setBrowserName("internet explorer");
//capability.setPlatform("WINDOWS");
//capability.setVersion("9.0.4");
WebDriver driver = new RemoteWebDriver(new URL(hubURL), capability);
driver.get("http://www.google.com");
WebElement element = driver.findElement(By.name("q"));
element.sendKeys("Cheese!");
element.submit();
driver.quit();
Run Code Online (Sandbox Code Playgroud)
虽然我从命令模式从节点指定IE,但是当它是IE9时我收到错误:
Exception in thread "main" org.openqa.selenium.WebDriverException: Error forwarding the new session cannot find : {platform=WINDOWS, ensureCleanSession=true, browserName=internet explorer, version=}
Command duration …Run Code Online (Sandbox Code Playgroud) 我的网站上有一个选择控件.我正在使用页面对象与页面进行交互.如果我这样做(我班下的前2行和selectByValue我的方法)
@FindBy(id="foo")
private Select foo;
foo.selectByValue("myValue");
Run Code Online (Sandbox Code Playgroud)
它失败并带有空指针.我也试过没有@FindBy.
现在,如果我在我的方法中这样做,一切正常并选择正确的项目
Select foo = new Select(sDriver.findElement(By.id("foo")));
foo.selectByValue("myValue");
Run Code Online (Sandbox Code Playgroud)
以下是该控件的实际Web代码段(已编辑以保护无辜者)
<select id="foo" name="service_name">
<option selected="selected" value="one">one</option>
<option value="two">two</option>
<option value="three">three</option>
</select>
Run Code Online (Sandbox Code Playgroud)
让我说我有一个解决我的问题但是我不明白为什么" 正常 "路径不起作用.
我一直在研究MongoDB上的数组(多键)索引,我有以下问题,我无法找到很多文档:
子文档数组的索引
所以如果我有一个看起来像这样的数组字段:
{field : [
{a : "1"},
{b : "2"},
{c : "3"}
]
}
Run Code Online (Sandbox Code Playgroud)
我只是在查询field.a和field.c独立(不是两者一起),我相信我有以下选项之间进行选择:
db.Collection.ensureIndex({field : 1});db.Collection.ensureIndex({field.a : 1});
db.Collection.ensureIndex({field.c : 1});那就是:整个数组的索引; 或嵌入字段上的两个索引.现在我的问题是:
在本地运行构建很好,没有任何问题。当我在 Azure Pipeline 上运行它时,它出错了。
详细的错误信息是
“SGen”任务的命令行太长。超过 32000 个字符的命令行可能会失败。尝试通过将对“SGen”的调用分解为多个调用来减少命令行的长度,每个调用的参数较少。[D:\a\1\s\eFetch.Web.Core\eFetch.Web.Core.csproj]
##[错误]C:\Program Files (x86)\Microsoft Visual Studio\2019\Enterprise\MSBuild\Current\Bin\Microsoft.Common.CurrentVersion.targets(3645,5):错误 MSB6003:指定的任务可执行文件“sgen” .exe”无法运行。System.ComponentModel.Win32Exception(0x80004005):文件名或扩展名太长
Azure Pipeline 上的 VSBuild
- task: VSBuild@1
inputs:
solution: '$(agent.builddirectory)\s$(Project1-Folder)$(Project1-Name).csproj'
msbuildArgs: '/p:OutputPath="$(build.binariesDirectory)$(Project1-Folder)\bin" /p:DeployOnBuild=true /p:DeployDefaultTarget=WebPublish /p:WebPublishMethod=FileSystem /p:SkipInvalidConfigurations=true /p:publishUrl="$(build.artifactStagingDirectory)$(Project1-Name)TempFolder"'
platform: '$(buildPlatform)'
configuration: '$(buildConfiguration)'
Run Code Online (Sandbox Code Playgroud)
我们做了一些研究。通常出现的是将GenerateSerializationAssemblies设置为Auto或Off。我们的项目已经处于“自动”状态,因此我们将其设置为“关闭”,但错误仍然存在。
有没有办法绕过某些 dll 引用的长路径?就像下面这样
另一种情况是多次调用 sgen.exe,但我们不确定如何执行此操作,因为 sgen.exe 是在 VSBuild / msbuild.exe 内部调用的。
理想情况下,我们希望不必关闭GenerateXmlSerialization,而是让它正常工作。
我意识到Selenium有隐式等待的默认值,但是如果我改变它,我该如何得到这个值?例如:
driver.implicitly_wait( 13 );
Run Code Online (Sandbox Code Playgroud)
我以后如何从驱动程序中获取13值?
我已经创建了几个RESTful微服务并对它们进行了对接.现在我想为他们建立一个基于Web的UI,并且能够创建用户并授予他们使用某些API的权限.
我知道我需要某种API网关.我的第一个想法是,我总是可以做那种暴力的方式:创建一些django应用程序,它将提供UI并代理所有API手动请求,但这似乎非常沉闷.也许有一些替代品?我已准备好了Tyk,但无法找到有关添加用户和授予权限的任何信息.
我可能可以创建一个可以作为API网关的应用程序,并通过编写一些可以对其进行建模的代码来自动代理请求.因此,例如,我基本上需要外部URL与实际api url和一些授权逻辑之间的映射.也许有类似的东西?
在MongoDB中,我需要能够在主文档内的数组内的文档中展开嵌套数组.
{
"_id" : ObjectId("5808d700536d1a3d69f4cf51"),
"last_name" : "Maity",
"xiith_mark" : 58,
"id" : "3539488",
"first_name" : "Harshavardhan",
"course_name" : "BE/B.Tech",
"institute_name_string" : "Abhayapuri College, P.O. Abhayapuri",
"profile_percentage" : 45,
"xiith_mark_type" : "Percentage",
"xth_mark_type" : "Percentage",
"date_of_birth" : "14-April-1993",
"xth_mark" : 30,
"last_login" : 1470827224,
"percentage" : 55,
"job_details" : [
{
"status" : NumberLong(6),
"applied_date" : NumberLong(1470831441),
"job_id" : NumberLong(92928),
"contact_viwed_status" : 0,
"label_name" : [
"shortlisted",
"rejected"
],
"questionnaire_status" : 0,
"batch_id" : NumberLong(6),
"call_letter" : NumberLong(812)
},
{ …Run Code Online (Sandbox Code Playgroud) 我正在为webpack使用angular-cli。
ng服务
然后构建成功,我看到了
** NG Live Development Server在http:// localhost:4200上运行。**
哈希:dd30d5aeee6e21802b4d e时间:9397ms
块{0} styles.bundle.js,styles.bundle.map(样式)163 kB {4} [初始] [渲染]
块{1} main.bundle.js,main。 bundle.map(主)6.52 kB {3} [初始] [渲染的]
块{2} scripts.bundle.js,scripts.bundle.map(脚本)361 kB {4} [初始] [渲染的]
块{3} vendor.bundle.js,vendor.bundle.map(供应商)2.22 MB [初始] [渲染]
块{4} inline.bundle.js,inline.bundle.map(内联)0字节[entry] [渲染]
webpack:捆绑包现在有效。
似乎没有错。但是访问http:// localhost:4200时,控制台上没有任何日志 。无论如何,我可以打开服务器登录控制台吗?
在spark Dataset.filter中获取此null错误
输入CSV:
name,age,stat
abc,22,m
xyz,,s
Run Code Online (Sandbox Code Playgroud)
工作代码:
case class Person(name: String, age: Long, stat: String)
val peopleDS = spark.read.option("inferSchema","true")
.option("header", "true").option("delimiter", ",")
.csv("./people.csv").as[Person]
peopleDS.show()
peopleDS.createOrReplaceTempView("people")
spark.sql("select * from people where age > 30").show()
Run Code Online (Sandbox Code Playgroud)
失败的代码(添加以下行返回错误):
val filteredDS = peopleDS.filter(_.age > 30)
filteredDS.show()
Run Code Online (Sandbox Code Playgroud)
返回null错误
java.lang.RuntimeException: Null value appeared in non-nullable field:
- field (class: "scala.Long", name: "age")
- root class: "com.gcp.model.Person"
If the schema is inferred from a Scala tuple/case class, or a Java bean, please try to use scala.Option[_] …Run Code Online (Sandbox Code Playgroud) 我试图操作的HTML:
<select id="GlobalDateTimeDropDown" class="combo"
onchange="CalculateGlobalDateTime('Time',this.value)" name="GlobalDateTimeDropDown">
<option value="+5.5" selected="selected"> … </option>
<option value="+12"> … </option>
<option value="+8"> … </option>
<option value="+2"> … </option>
</select>
<input id="GlobalDateTimeText" class="combo" type="text" name="GlobalDateTimeText" value="" style="width:215px;padding:2px;" readonly="readonly"></input>
Run Code Online (Sandbox Code Playgroud)
Java代码:
WebElement values=driver.findElement(By.id("GlobalDateTimeText")).getAttribute("Value");
System.out.println(values);
Run Code Online (Sandbox Code Playgroud)
输出:空白