跳至內容
選單
此問題已被標幟
3 回覆
5201 瀏覽次數

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
6648
3
4月 21
8373
2
6月 20
5643
1
10月 19
4601
1
3月 15
13813