Robotframework . How I handle collapsible menu? - robotframework

I try to use Click Element id=elementid in Robotframework.I have Selenium2 Library.I have a Menu collapsible.See little arrow on Entity 1 on first print screen.I try to identify the element id.I cannot see element id when I inspect this.I see only jotid that I do not think is the same.So, I am not able to use click element in order to expand my menu.I appreciate anyone's help as I am still learner.Please see also the images of a) Code, Menu, Inspected Element

You can also find it using xpath, so:
Click Element | //li[#wuid="gx:309..."]

jotid is not id, so you cannot locate it by id.
You could try keyword:
Click Link ENTITY 1 -Introduction
or find it by css:
Click element css=a[jotid='wuid:gx:4286...<the rest of it>']

Related

Correct CSS-selector in Click Element (GTM trigger)

I am lost with getting a trigger to fire for all menu items on my site. As there is no Class element given I try to do the check with the Click Element field (. But any part of it I try I get a mismatch in GTM preview mode.
Can anyone tell me what would be valid CSS selector for that trigger?
Click Element for menu item "Kontakt" is
https://www.deutschland-greeter.de/kontakt/: html.js > body.home.page-template-default.page.page-id-39.et_pb_button_helper_class.et_fixed_nav.et_show_nav.et_primary_nav_dropdown_animation_fade.et_secondary_nav_dropdown_animation_fade.et_header_style_left.et_pb_footer_columns1.et_cover_background.et_pb_gutter.windows.et_pb_gutters3.et_pb_pagebuilder_layout.et_no_sidebar.et_divi_theme.et-db.chrome > div.et-animated-content#page-container > header.et-fixed-header#main-header > div.container.clearfix.et_menu_container > div#et-top-navigation > div#et_mobile_nav_menu > div.mobile_nav.closed > ul.et_mobile_menu#mobile_menu > li.testclass.menu-item.menu-item-type-post_type.menu-item-object-page.menu-item-1094#menu-item-1094 > a
One of the matches I tried is div.container.clearfix.et_menu_container
Thanks a lot!
Klaus
This will work for both desktop and mobile Kontakt in the main menu:
li#menu-item-1094>a[href="https://www.deutschland-greeter.de/kontakt/"]
If you want to have it for every a on the page that leads to /kontakt/ (like what you have in the footer), use this:
a[href="https://www.deutschland-greeter.de/kontakt/"]
I would go with the first option.
Here's a variant that will catch all top menu clicks for desktop:
ul#top-menu>li>a
Keep in mind that using CSS selectors for tracking (also referred to as DOM scraping) is ultimately not reliable since front-end devs won't keep your tracking in mind when they update the site.

Chrome console to click

i would like to use the Chrome-console to click on a button.
So far I always used the Id, like:
$('[id="vcc-eu5"]').click();
or Title
$('[title="Delete this view and its saved rules"]').click();
of the button, but here, I can not find anything like that.
If I inspect the button I can see this:
<a class="wds-button wds-button--primary wds-button--sm apply-btn ">APPLY</a>
Is there a way trigger this button somehow? Where can I read about it?
The currently selected element in the Chrome DevTools is always available as $0.
So, you can just select it and the do $($0).click()
Or you can use a unique combination of its classes:
$('a.wds-button.wds-button--primary.apply-btn').click()

How to select an option from a drop down?

When I'm trying to select any one of the options from a drop down "Birthday" on Google account creation page using .xpath, I found the xpath as follows:
.//*[#id=':a'] but it was not selecting the desired option the drop down. But, when I added /div at the end of the same xpath i.e .//*[#id=':a']/div it worked.
Can anyone explain why I should add /div at the end?
It was happened because your proper Element is //*[#id=':a']/div not just //*[#id=':a']
See the image below :-

"value error: Element locator did not match any element." while trying to locate a element

I am using Robot Framework with Selenium2Library for website tests automation. My HTML Value is
<select class="autoWidth m![Element Locator Error][1]inWidth" id="ctl00_ResultPanePlaceHolder_ctl00_ctl02_ctl01_contentContainer_ddlLanguage" name="ctl00$ResultPanePlaceHolder$ctl00$ctl02$ctl01$contentContainer$ddlLanguage">
<option value=![enter image description here][2]"1118">አማርኛ ‎(ኢትዮጵያ)‎</option>
I am using cmd
Click Element id=ctl00_ResultPanePlaceHolder_ctl00_ctl02_ctl01_contentContainer_ddlLanguage
I am getting
value error: Element locator did not match any element.
How to fix this issue.
Most likely your element is inside an iframe. Look through the html to see if you see <iframe ...> before the element you are trying to click. If so, you first need to use Select Frame before trying to click on the element.
You should need to use id= as ID is one of the default attributes it looks for. Is it possible to see some more of the html code surrounding the element you are after?

How to click on Toolbar element with Sahi for Test Automation?

Web page contain a button with some text for example "Test". This button actually is a toolbar element. (class ="tbButton" id="id",text="Test") and redirects to a certain table when press on it.
When I tried to use the following click methods, the button did not react.
browser.div("Test").click();
browser.click("id");
browser.click("");
browser.div("id").click();
browser.byId("id").click();
browser.containsText(browser.byId("id"),"Test");
browser.div("Test").in(browser.table("Generar")).click();
browser.byXPath("//div/Test").click();
Could anybody suggest me an alternative methods that is able to resolve the above problem?
Try with:
browser.xy(browser.div("Test"), 10, 10).click();
This will click a little inside the div.

Resources