I need to access this text in the picture. I am using VB.NET and I need to show me in a MessageBox. The sentence is: "My friend is going to watch a film in cinema but there is no tickets.". When I right click on this and get the full Xpath, it shows me this:
/html/body/div[7]/div[3]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div[1]/div/div/div[9]/div/div[1]/div[2]/div/table/tbody/tr[1]/td[4]/div[1]/text()[4]
So this is the code I use in VB.NET:
MsgBox(driver.FindElement(By.XPath("/html/body/div[7]/div[3]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div[1]/div/div/div[9]/div/div[1]/div[2]/div/table/tbody/tr[1]/td[4]/div[1]/text()[4]")))
But I get following error:
OpenQA.Selenium.InvalidSelectorException: 'invalid selector: The result of the xpath expression "/html/body/div[7]/div[3]/div/div[2]/div[2]/div/div/div/div/div[2]/div/div[1]/div/div/div[9]/div/div[1]/div[2]/div/table/tbody/tr[1]/td[4]/div[1]/text()[4]" is: [object Text]. It should be an element.