跳至内容
菜单
此问题已终结
3 回复
5182 查看

Hello,

I am using Odoo15, and I am trying to access the text content in the following XML code :



I have tried using //div/text() and also //div[contains(text(), 'On hand: ')] but that did not work. Can anyone help me?


形象
丢弃
最佳答案

If you need to change the On hand string, try replacing the entire div

形象
丢弃
最佳答案

xpath locating by text() (contents) breaks in translated context.

So you'll get the error "element cannot be located in the parent view".

形象
丢弃
最佳答案

You can try this expr

expr="//*[text()='On hand: ']"

形象
丢弃
编写者

I get the following error when accessing the view :
" the element cannot be located in the parent view "

can you share your code ?

相关帖文 回复 查看 活动
1
4月 22
6641
3
4月 21
8360
2
6月 20
5617
1
10月 19
4591
1
3月 15
13800