Element locator not found - selenium

I use Selenium2Library with Robotframework. With my code source, I go to a web browser and after 2 windows open. Then I close one window after I try to click on an element locator on the window but the element isn't found. I have error : 'id=ggroup1Mon' did not match any elements after 5 seconds.
Open Browser http://10.70.150.34/avldisplay/MONITORING/Authentification
Wait Until Element Is Visible id=j_username
Click Element id=j_username
Input Text id=j_username 452
Wait Until Element Is Visible id=j_password
Click Element id=j_password
Input Text id=j_password 463425
Wait Until Element Is Visible xpath=//button[#type='submit']
Click Element xpath=//button[#type='submit']
${az}= List Windows
Select Window #{az}[1]
Close Window
Select Window #{az}[0]
Wait Until Element Is Visible id=ggroup1Mon
#Click Element id=ggroup1Mon

Related

How to get locator of the element that when we click on element , element is hidd from webpage. (Autosuggestive Dropdown)

How to get locator of the element that when we click on element , element is hidd from webpage. (Autosuggestive Dropdown)
Check this video: https://www.awesomescreenshot.com/video/14718103?key=d62686524ee669202bc48d3642ccc6ff
When clicking on the auto suggestive dropdown then, autosuggestive dropdwon value is hidden,
so how to get the locator for this.

How to switch from current tab to next opened tab in Robot Framework

How to switch from current tab to next opened tab in similar browser in Robot Framework.
You can make use Select Window keyword to navigate tabs in a browser using selenium2Library.
Here, Select Window keyword selects the tab based on title of the page.
By default the locator is matched against window handle, name, title,
and URL. Matching is done in that order and the the first matching
window is selected.
Sample Scenario
*** Settings ***
Library SeleniumLibrary
*** Test Cases ***
NAVIGATE TABS
OPEN BROWSER <<URL>> FF
Click Element << ELEMENT WHICH EXISTS >>
Select Window title=<<TITLE NAME>>
If we do not know the title/url of the new Tab AND want to navigate to the last tab then, you can try with the following snippet of code,
If the locator is NEW (case-insensitive), the latest opened window is
selected. It is an error if this is the same as the current window.
${handle} = Select Window NEW # Select latest opened window
If you want to switch back to the original tab:
Navigate Tabs
Go To <<url>>
Click Element xpath=<<xpath>> # opens a new tab
${tab1}= Select Window NEW # switch to new tab and get original tab handle
Sleep 10 # do stuff in new tab
Select Window ${tab1} # switch back to original tab

selenium send key for xpath not working

I want make automation for this web site
in this web site 3 text box are here check image
1st text box x path is /html[1]/body[1]/div[3]/div[1]/div[2]/div[1]/searchbar[1]/div[1]/div[1]/div[1]/div[1]/form[1]/div[1]/div[1]/div[1]/input[1]
here is my code
driver.findElement(By.xpath("/html[1]/body[1]/div[3]/div[1]/div[2]/div[1]/searchbar[1]/div[1]/div[1]/div[1]/div[1]/form[1]/div[1]/div[1]/div[1]/input[1]")).sendKeys("rio salon");
when I run this code I got this error
Exception in thread "main"
org.openqa.selenium.ElementNotInteractableException: Element is not reachable by keyboard
How can i fix it? I hope my xpath is correct.
The field has aria-hidden=true attribute, so you get ElementNotInteractableException. You need to click on the dropdown first to change the attribute to true
WebElement dropdown = driver.findElement(By.xpath("//*[#id='search-form']/div/div[1]/div/div[1]/span"));
dropdown.click();
WebElement textField = dropdown.findElement(By.xpath("./parent::div/following-sibling::input[contains(#class, 'ui-select-search')]"));
textField.sendKeys("rio salon");
You can click in an input field with a div or span tag, but you cannot type in the field. So, your XPath must be written with an input tag if you want to sendkeys or type in an input field. For example:
//input[contains(#placeholder,'Site')]

How can I select an element which appears in popup window using Selenium?

I have selected the popup window using cssSelector
ex:
WebElement a = TestApp.getInstance().getDriver().findElement(By.cssSelector("#PopupWindow0")) ;
now I want to select an element which is inside this popup.
After you retrieved WebElement 'a' you can call .findElement on it, for example:
a.findElement(By.id("example"));
This will search for all elements inside the pop-up window

Selenium select a text in a not select input

How to select an element in this web element :
this input is a text type and not a select option !!!
Type some characters (or all/none of them) in that input box
Wait until the options appear
Take the identifier (id/XPath/class/CSS/etc.) of that element (option) (maybe it is a div)
F12 in Chrome > click on the magnifier > click on the option
F12 in Firefox/Internet Explorer > click on the arrow > click on the option
Click on that elements / take its content