Home > OS >  i can not get Text of an Element
i can not get Text of an Element

Time:11-09

i go to this website: https://www.drk-kv-calw.de/kurse/erste-hilfe-eh/rotkreuzkurs-erste-hilfe.html

driver.get("https://www.drk-kv-calw.de/kurse/erste-hilfe-eh/rotkreuzkurs-erste-hilfe.html");
WebElement bir=driver.findElement(By.xpath("(//a[text()='Link zur Karte'])[4]"));
WebElement iki=driver.findElement(By.xpath("(//a[@title='bei Kurs anmelden'])[4]"));
WebElement deneme=driver.findElement(RelativeLocator.with(By.tagName("br")).below(bir).toLeftOf(iki));
System.out.println("text : " deneme.getText());

. I want to reach the text of "" 50,00 € , 9 Plätze vorhanden - anmelden "" but it does not bring me the content of the text. How do you think I should locate this article and how can I reach this article? Thanks in advance.

CodePudding user response:

You can get the text - '50,00 € , 9 Plätze vorhanden - ' using the following XPath:

//*[contains(text(),'EHLBG/2022/048/53')]//parent::div//parent::div/text()[3]

You can get the text - 'anmelden' using the following XPath:

//*[contains(text(),'EHLBG/2022/048/53')]//parent::div//parent::div/a[2]/text()
  • Related