์ํ๋ ๋ฌธ์์ด์ธ ์์ ์ฐพ๊ธฐ
ex) ์์์ ๋ด์ฉ์ด foo์ธ ๊ฒ์ ์ฐพ๊ธฐ
//myparent/mychild[text() = 'foo']
์ํ๋ ๋ฌธ์์ด์ด ํฌํจํ(contains) ์์ ์ฐพ๊ธฐ
ex) ABC๋ผ๋ ๋ด์ฉ์ ํฌํจํ ์๋ ์์ ์ฐพ๊ธฐ
//*[contains(text(),'ABC')]
ํ์ด์ฌ ์ฌ์ฉ ์์
driver.find_element_by_xpath('//span[contains(text(),"ABC")]')
์๋ฐ์คํฌ๋ฆฝํธ(๋ธ๋ผ์ฐ์ ๊ฐ๋ฐ์ ๋๊ตฌ) ์ฌ์ฉ ์์
$x("//*[contains(text(),'12:00')]")
๊ทธ ๋ฌธ์์ธ ๊ฒ์ ์ฐพ๊ธฐ
$x('//*[text()="๋ค์ด๋ฒ๋ก ์ด์ฉํ๊ธฐ"]')
์์ฑ(class๋ id) ๊ฐ์ด ํน์ ๋ฌธ์๋ก ์์ํ๋ ์์ ์ฐพ๊ธฐ
$x("//div[starts-with(@class, 'PP-')]")
์ถ์ฒ:
https://stackoverflow.com/questions/1998681/xpath-selection-by-innertext
XPath selection by innertext
I'm trying to extract an element with a particular innertext from a parsed XML document. I know that I can select an element that has a child with a particular innertext using //myparent[mychild='...
stackoverflow.com
XPath contains(text(),'some string') doesn't work when used with node with more than one Text subnode
I have a small problem with XPath contains with dom4j ... Let's say my XML is <Home> <Addr> <Street>ABC</Street> <Number>5</Number> <
stackoverflow.com
Python Selenium - Find element whose class name starts with something
How can I retreive an element whose class name starts with, let's say: "PP-". I tried this without success: driver.find_element_by_css_selector("div[class^='PP-']")
stackoverflow.com