我尝试使用RSelenium从元素中获取href。
以下是html结构的示例:
<ol id="rem">
<div class="bare">
<h3>
<a class="tlt mhead" href="https://www.myexample.com">
我用这个:
pro<-remDr$findElement(using = 'xpath', "//*/input[@class = 'bare']")
pro$highlightElement()
但它无法找到该元素并返回此错误:
Error: Summary: NoSuchElement
Detail: An element could not be located on the page using the given search parameters.
class: org.openqa.selenium.NoSuchElementException
我该怎么办?
答案 0 :(得分:0)
"values-in"
"values-in-rID"
元素不是import java.util.ArrayList;
import java.util.Hashtable;
import java.util.Iterator;
import java.util.List;
import java.util.Map;
public class Exam {
public static void main(String[] args) {
DbConnection dc1 = new DbConnection("EGPRD","SYSTEM","AAA","dh7y7hdu", "oracle");
DbConnection dc2 = new DbConnection("EGPRD","SYSTEM","AAA","d6f7d6fd", "linux");
DbConnection dc3 = new DbConnection("EGPRD","ADM","RDA","d6f7d6fd", "linux");
DbConnection dc4 = new DbConnection("SOPRD","DBLINK","ACT","fdf7f87e8", "oracle");
List<DbConnection> dcList = new ArrayList(4);
dcList.add(dc1);
dcList.add(dc2);
dcList.add(dc3);
dcList.add(dc4);
Map uniqueTable = new Hashtable();
for( DbConnection fDc : dcList ){
uniqueTable.put(fDc.key, fDc);
}
for( Iterator it = uniqueTable.keySet().iterator();it.hasNext(); ){
DbConnection mDc = (DbConnection)uniqueTable.get(it.next());
System.out.println( "1234" + "\t"+ mDc.DbName + "\t" + mDc.SchemaName + "\t" + mDc.AppId);
}
}
}
class DbConnection{
public DbConnection(String dbName, String schemaName, String appId, String host, String osUser) {
super();
DbName = dbName;
SchemaName = schemaName;
AppId = appId;
Host = host;
OsUser = osUser;
key = DbName + SchemaName + AppId; // key generation
}
public String key;
public String DbName;
public String SchemaName;
public String AppId;
public String Host;
public String OsUser;
}
类,class DbConnectionEx extends DbConnection{
public String key;
public DbConnectionEx(String dbName, String schemaName, String appId, String host, String osUser) {
super(dbName, schemaName, appId, host, osUser);
key = DbName + SchemaName + AppId; // key generation
}
}
(假设input
是拼写错误):
bare