I'm experiencing a very annoying bug with selenium IDE, firefox and html runner.
I'm testing a single page, with an inner iframe dinamically loaded after a click on a button.
I can see the iframe content by selectFrame | id=frame1 and all is ok.
Then, i click a button on the frame and this cause the iframe to be unloaded.
After that, i can't access to anything in the main page, even if i do:
selectWindow | title=, the command is ok, that is the same as SwitchTo().DefaultContent(), but it seems all the content is no more here, every xpath lookup fails.
I tried assigning a button id to a variable BEFORE loading and unloading the iframe with assignId | //button[2],
but when later i use the variable to access the button i get
can't access dead object
It seems that unloading the inner iframe all the content in the outer window was lost, but the page is already there ( iput a waitForElementPresent to wait indefinitely and i see the page with all its stuff.
Any ideas ?
Firefox 59
Selenium IDE 2.9.1
Selenium Gecko Driver 0.20
Selenium html runner 3.10
Thanks a lot.
Related
I encountered a problem automating a test-procedure on my website. I there have a list of items and - to add a new one - a modal openes. Everything's fine til then - the RobotFramework fills out the checkboxes and inputs with text, but when it comes to the "Save"-button, Chrome and Firefox response differently.
Chrome does everything correct, closing the modal and saving the new item. Firefox on the other hand seems to click the button too, but nothing happens. The code "behind" the button is as follows:
<button id="submitSomething" type="submit" name="someName"
value="Save" onclick="window.wishlist.editPreSubmit(this, event)">Save</button>
Python 2.7.x (latest) 32 bit
wxPython 2.8 32 bit
geckodriver latest 64 bit
chromedriver 2.45
I tried somehing like:
Execute Javascript document.querySelector("#submitNew").click()
instead of
Click Button id=submitSomething
but without a change on Firefox sadly. Every tiny help would be greatly appreciated :)
Edit:
If I use
document.querySelector("#submitNew").click()
in the console of the browser which was opened from robotframework, it does not work either (firefox) and I get a warning:
form posted in windows-1252-codec, should be changed to utf-8
Br
To click the desired element you need to induce WebDriverWait for the element to be clickable and you can use either of the following solutions:
Wait Until Element Is Visible:
Wait Until Element Is Visible xpath=//button[#id='submitSomething' and #value='Save'][contains(., 'Save')] 20 seconds
Set Focus To Element xpath=//button[#id='submitSomething' and #value='Save'][contains(., 'Save')]
# invoke click
Wait Until Element Is Enabled:
Wait Until Element Is Enabled xpath=//button[#id='submitSomething' and #value='Save'][contains(., 'Save')] 20 seconds
Set Focus To Element xpath=//button[#id='submitSomething' and #value='Save'][contains(., 'Save')]
# invoke click
I am using nightwatchjs for end to end testing. My test passes for chrome, firefox, ie and edge but one of the test fails for phantomjs. click event for url seems to fail.
'do somethings' : function(browser) {
browser
.setValue('input[id=SearchInput]', '000')
.click('button[id=Button]')
.assert.containsText('label[id=nOutput]', '000')
.click('a[id=link]')// this click is not working
.pause(1000)
.assert.value('input[id=Input]', 'A')
.assert.value('input[id=InputB]', 'B')
//reset page
.click('button[id=__xmlview0--clearButton]')
.end()
},
Thanks for help.
Looks like a Selenium issue.
https://github.com/SeleniumHQ/selenium-google-code-issue-archive/issues/5404
Selenium first gets the element's position, then sends a mouse click event. If the element moved between the time, the element will not be clicked.
I've encountered this too, my test case is trying to click A, but B gets clicked. Still trying to figure out a solution.
In another project I also encountered another reason. The page is responsive-ready, some elements are display:none when browser width is less than, say, 1000px. When nightwatch launches Chrome or Firefox, the browser window is full screensize, but phantomjs's default viewport size triggers the responsive condition. So Selenium cannot even find the element I want to click.
After exhaustively searching for this over various forums, I still don't have an answer.
Here are complete details
I'm identifying the element through classname which points to multiple(4) buttons. I'm iterating through buttons and then search for text and when there is a match i click it.
This works fine with selenium webdriver and browsers such as firefox,chrome
Now I'm doing the same thing with appium.
Out of 4 buttons which are identified through classname, the script clicks 2 buttons successfully but for two buttons click happens(i can see the button being clicked) but new page which should be loaded is not loaded. The buttons for which click is not happening are in a footer class and other two are in div class.
Things i have already tried
Actions builder - click(), clickandhold()
Javascript executor
I'm currently trying with touch options, tap and by switching to native view but haven't found any success.
If any has encountered the same, a solution will be appreciated.
I want to avoid xPath because that might change in the page I'm working on, and I want to stress that the script is able to find the button, but is not able to click it properly.
You can filter your locator by using class name and index. Like this:
driver.findElementsByXPath("//*[#class='android.widget.ImageView' and #index='0']");
This xpath won't get change on other devices too.
Could you see: Unable to find an element in Browser of the Android emulator using Appium and C# ?
In case of testing web apps in browser the elements should be located as usual elements on the web page ( not as some classes like android.widget.EditText and android.widget.Button).
Upadting appium java client to 1.5.0 (from 1.3.0) solved the issue. Need to check why!
I have an html page that has a small piece of JavaScript that further embeds an HTML form in a div tag (this div is identified by an ID).
I want to use Selenium IDE to test the form. I recorded a basic test to test the embedded form but Selenium seems to be failing. It cannot find the elements or the text.
I got the source of the parent html page but it does not have any Form html. Firefox allows you to see the Form html by going to 'This Frame->View Source'. The embedded html is whole html page not just the form - I mean it starts and ends with <html> tag
I was wondering how could I test the embedded form using Selenium IDE ? I searched a lot and found 'SelectFrame' but all the examples on the web include Java code (that I do not wish to get into) as opposed to plain HTML (I would like my test to be plain HTML Selenium test cases and would like to keep it simple).
Also, I doubt if 'SelectFrame' is going to help as the form gets embedded in a 'Div' tag and not in the frame.
Any help is greatly appreciated.
Thanks
you have a frame and frame have some name, please use this and let me know
selectFrame | frame name |
verifytext | text
selectWindow | null - this for release the frame
please show me once your script so that I will help you futher
use
driver.switchTo().frame("marco");
replace "marco" with your own frame name
I'm testing a richfaces application with selenium. It works fine, unless I use reRender. (for those unfamiliar with richfaces - whenever an ajax request finished, parts of the DOM are updated/chagned/removed).
So, after a reRender selenium (the IDE at least) fails to locate the elements which were within the reRendered area. Both FireBug and WebDeveloper locate the elements, and on "view source" the elements are there.
So, is there a way to tell selenium to update its DOM "knowledge" with the latest changes?
Firefox 3.5.6, latest version of Selenium IDE.
I'm using Fifefox 3.6.8, Selenium IDE 1.0.7, and RichFaces 3.3.1, running on Ubuntu Linux. I don't have this problem.
I have a simple form where the selection of a radio button triggers a reRender of an a:outputPanel. Initially, the panel is empty. If the right radio button is selected, the rendered condition is met, and the panel is rerendered with its children components. I am able to set a waitForCondition to look for an element id that will appear as a child of the panel, and I am able to verify the child elements after they appear. Selenium IDE correctly identifies these child elements when I right click in Firefox.
Selenium doesn't keep a cached version of the DOM. It can't because it is using JavaScript and all javascript DOM queries are always live.
What are you using to find the elements? If you are using Xpath/CSS selectors then there is a chance that the XPath is no longer valid or the CSS selector may not be correct.