Siirry sisältöön
Menu
Sinun on rekisteröidyttävä, jotta voit olla vuorovaikutuksessa yhteisön kanssa.
Tämä kysymys on merkitty
3 Vastaukset
4868 Näkymät

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?


Avatar
Hylkää
Paras vastaus

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

Avatar
Hylkää
Paras vastaus

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

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

Avatar
Hylkää
Paras vastaus

You can try this expr

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

Avatar
Hylkää
Tekijä

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

can you share your code ?

Aiheeseen liittyviä artikkeleita Vastaukset Näkymät Toimenpide
1
huhtik. 22
6041
3
huhtik. 21
7863
2
kesäk. 20
5235
1
lokak. 19
4267
1
maalisk. 15
13443