<div id="ContentPrimary">
<ul class="selectors modeSelectors">
<li><a href="/content/l411846326l1213g/references/" title="">
<span class="selector">References (27)</span></a></li>
<li><a href="/content/l411846326l1213g/referrers/" title="">
<span class="selector">Cited By (2)</span></a></li>
<li><a href="/content/l411846326l1213g/export-citation/" title="">
<span class="selector">Export Citation</span></a></li>
<li><a href="/content/l411846326l1213g/about/" title="">
<span class="selector">About</span></a></li>
</ul>
Run Code Online (Sandbox Code Playgroud)
在这里我需要找到并使用Selenium api 点击关于链接,但我无法做到.
我做的是
wait.until(new ExpectedCondition<Boolean>() {
public Boolean apply(WebDriver webDriver) {
System.out.println("Searching ...");
String s = driver.findElement(By.cssSelector("#ContentPrimary ul li[4] span.selector")).getText();
System.out.println(s);
if (Pattern.compile(Pattern.quote("About"), Pattern.CASE_INSENSITIVE).matcher(s).find()) {
return true;
} else {
return false;
}
}
});
driver.findElement(By.linkText("About")).click();
Run Code Online (Sandbox Code Playgroud)
但它不起作用
我正在使用JS控制器在Alfresco编写WebScript,我想向本地HTTP资源发出HTTP请求.此资源是基于Java的应用程序,并为我提供了自己的REST API.
我的WebScript不是共享组件:所以我没有remote对象来调用另一个webscript.
如何从WebScript向本地资源(类似'/ sdo/documents/getName?type = fl')发出HTTP请求?
我目前使用以下脚本从网站登录时间。
browser = webdriver.Chrome('E:/Shared Folders/Users/runnerjp/chromedriver/chromedriver.exe')
browser.get("https://www.timeform.com/horse-racing/account/sign-in?returnUrl=%2Fhorse-racing%2F")
time.sleep(3)
username = browser.find_element_by_id("EmailAddress")
password = browser.find_element_by_id("Password")
username.send_keys("usr")
password.send_keys("pass")
login_attempt = browser.find_element_by_xpath("//input[@type='submit']")
time.sleep(3)
login_attempt.submit()
Run Code Online (Sandbox Code Playgroud)
它可以正常工作,但是我发现使用Chrome网络驱动程序会严重影响我的CPU。有没有我可以使用的替代代码,并不意味着我需要实际加载页面才能登录?
我想通过Backend webscript获取节点详细信息但我有一些问题.我试过两个webscripts:
alfresco/service/slingshot/doclib2/node/workspace/SpacesStore/a10a0777-40f4-42da-b236-8845eb26294e
alfresco/service/slingshot/doclib/node/workspace/SpacesStore/a10a0777-40f4-42da-b236-8845eb26294e.
第一个给了我这个回复:
{
"status" :
{
"code" : 410,
"name" : "Gone",
"description" : "Resource is no longer available at the server and no forwarding address is known."
},
"message" : "Location is 'null'. (No permission?)",
"exception" : "",
"callstack" :
[
],
"server" : "Enterprise v4.2.0 (r57217-b28) schema 6,034",
"time" : "Jun 10, 2014 10:28:15 AM"
}
Run Code Online (Sandbox Code Playgroud)
第二个:
{
"status" :
{
"code" : 500,
"name" : "Internal Error",
"description" : "An error inside the …Run Code Online (Sandbox Code Playgroud)