Gerekli URL'de bulunan tüm bağlantı sayfalarının içeriğini kontrol etmeye çalışıyorum.Selenide geçersiz seçici: Xpath ifadesiyle bir öğe bulunamıyor
1- Gerekli URL'ye
2- onay bağlantıları için doğrulama (href içeriği) her bağlantı
için3- gezinmek tüm bağlantıları bulmak:
yüzden aşağıdakileri yapın
5- her bağlantının
String[] links = null;
int linksCount = 0;
System.setProperty("webdriver.chrome.driver", "Resources/chromedriver.exe");
WebDriverRunner.setWebDriver(new ChromeDriver());
driver= WebDriverRunner.getWebDriver();
open("http://vanilla.sa/");
List<WebElement> linksize = WebDriverRunner.getWebDriver().findElements(By.tagName("a"));
linksCount = linksize.size();
links= new String[linksCount];
out.println("List of links Available: ");
for(int i=0;i<linksCount;i++)
{
links[i] = linksize.get(i).getAttribute("href");
}
// navigate to each Link on the webpage
for(int i=0;i<linksCount;i++)
{
System.out.println(links[i]);
driver.navigate().to(links[i]);
Selenide.sleep(7);
WebElement error = $(Selectors.byText("condition"));
$(error).shouldNotBe(visible)
.shouldNotBe(text("condition"));
}
alth yönelik durumunu kontrol ough Bir url için bu durumu kontrol etmeye çalıştı ve işe yaradı ama otomatik ardından
Yukarıdaki örnekte olduğu gibi farklı bağlantılar (URL'ler) için navigasyon aşağıdaki istisna ne zaman:
http://vanilla.sa/%D8%AD%D9%82%D8%A7%D8%A6%D8%A8/%D8%AD%D9%82%D8%A7%D8%A6%D8%A8-%D9%83%D8%A8%D9%8A%D8%B1%D8%A9 org.openqa.selenium.InvalidSelectorException: invalid selector: Unable to locate an element with the xpath expression
.//*/text()[normalize-space(.) = "condition"]/parent::*
because of the following error: TypeError: Failed to execute 'createNSResolver' on 'Document': parameter 1 is not of type 'Node'. (Session info: chrome=49.0.2623.87) (Driver info: chromedriver=2.9.248315,platform=Windows NT 6.2 x86_64) (WARNING: The server did not provide any stacktrace information) Command duration or timeout: 74 milliseconds For documentation on this error, please visit: http://seleniumhq.org/exceptions/invalid_selector_exception.html Build info: version: '2.50.1', revision: 'd7fc91b', time: '2016-01-29 19:04:49' System info: host: 'Hana', os.name: 'Windows 8', os.arch: 'amd64', os.version: '6.2', java.version: '1.7.0_80' *** Element info: {Using=xpath, value=.//*/text()[normalize-space(.) = "condition"]/parent::*
} Session ID: 94c50df8d0862e2060230a819395224e Driver info: org.openqa.selenium.chrome.ChromeDriver
WebElement hatası = driver.findElement (By.xpath (" .// metin() [. Normalleştirmek-boşluk() = \ "" + "durum" + "\"]/ebeveyn :: * ")); – Hana90
org.openqa.selenium.NoSuchElementException: böyle bir öğe yok *** Öğe bilgisi: {Using = xpath, value =. // text() [normalize-boşluk (.) = "Koşul"]/parent :: *} – Hana90
lütfen bu http://stackoverflow.com/questions/36128144/invalid-selector-matter-of-loading-page-or-not – Hana90