Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[8.0] Can't find an element in wizard #57

Open
livingmine opened this issue Jun 16, 2017 · 4 comments
Open

[8.0] Can't find an element in wizard #57

livingmine opened this issue Jun 16, 2017 · 4 comments

Comments

@livingmine
Copy link

I've noticed that in odoo_9_0_EE.robot and odoo_10_0.robot there exist ButtonWizard (which i assume it is for clicking button in wizard) while there is no equivalent keyword for Odoo 8.0. I've been trying to trigger the click event using Selenium2Library ClickElement with proper xpath (copied directly from Copy Xpath from inspect mode) selector to achieve the same functionality but unfortunately the following error occured

ValueError: Element locator 'xpath=/html/body/div[5]/div/div/div[1]/button' did not match any elements.

Is it possible to achieve the same in Odoo 8.0?

@Jerther
Copy link
Contributor

Jerther commented Jun 16, 2017

I think it's better to use the data-bt-* attributes added by the web_selenium module developed by brain-tec.
If you're using odoo_robot-framework, my guess is that you already know about it but if not, it adds some attributes to your buttons and thus makes writing tests way easier.

Check it out: https://github.com/brain-tec/web_selenium

@livingmine
Copy link
Author

@Jerther Yes, i've already knew and been using web_selenium. The thing is AFAIK, web_selenium does not seem to add the data-bt-* attributes to some elements and one of them is this "button in the wizard" element which i've been trying to interact with. I use data-bt-* attributes for most of other elements and in fact i'm using most of the keyword in odoo_8_0.robot without any problems except for this particular element. Am i missing something?

@Jerther
Copy link
Contributor

Jerther commented Jun 16, 2017

Yeah sometimes the module fails to add attributes to buttons in a modal form. IIRC it may not be possible in a technical point of view. Here are some examples of what I do in this exceptional situation:

Click Button xpath=//div[@class='modal-footer']//button//span[.='Ok']/..
Click Button xpath=//div[@class='modal-footer']//button/span[.='Cancel']/..

These suppose there is only one modal shown. They work in Odoo 10 and should also work in Odoo 8.

If this still doesn't work, then make sure the modal form is loaded, actually visible and usable when you're calling the keywords.

@livingmine
Copy link
Author

@Jerther Thanks for the tips! Anyway, i was wrong about this particular element i've described above. The data-bt-* attribute exists, however it seems that the selector can not locate the element, possibly due to its appearance is inside the modal. I'll try your suggestions first then reporting back to this thread.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

2 participants