1. 父节点的兄弟节点
1.1 text为’Firefox的a节点的父节点(/..或者/parent::*)的兄节点(位置在父节点前面),这个节点类型不知(preceding-dibling::*,*代表任何tag类型),但是该节点的class含有字符串‘hehe’
//a[text()="Firefox"]/../preceding-sibling::*[contains(@class, 'hehe')]
or
//a[text()='Firefox']/parent::*/preceding-sibling::*[contains(@class, 'hehe')]
1.2 text为’Firefox的a节点的父节点(/..或者/parent::*)的弟节点(位置在父节点后面),这个节点类型不知(following-dibling::*,*代表任何tag类型),但是该节点的class含有字符串‘hehe’
//a[text()="Firefox"]/../following-sibling::*[contains(@class, 'hehe')]
or
//a[text()="Firefox"]/parent::*/following-sibling::*[contains(@class, 'hehe')]
1.3 text为’Firefox的a节点的父节点(/..或者/parent::*)的兄节点(位置在父节点前面),这个节点类型为a(/preceding-sibling::a)并且class含有字符串‘hehe’
//a[text()="Firefox"]/../preceding-sibling::a[contains(@class, 'hehe')]
or
//a[text()='Firefox']/parent::*/preceding-sibling::a[contains(@class, 'hehe')]
1.4 text为’Firefox的a节点的父节点(/..或者/parent::*)的弟节点(位置在父节点后面, /following-sibling::a),这个节点类型为a(/following-sibling::a)并且class含有字符串‘hehe’
//a[text()="Firefox"]/../following-sibling::a[contains(@class, 'hehe')]
or
//a[text()='Firefox']/parent::*/following-sibling::a[contains(@class, 'hehe')]