I have a typical problem with selenium Ide: [error] = * css Element not found.
I looked in the forum and I have seen very similar questions (eg, selenium-IDE-2.9.0 - [error] = li.xspPickerItem.xspPickerItemHover css Element not found), have tried to solve the problem with some of the suggested answers but I could not.
The details of my problem is as follows:
Log:
info] Executing: |click | css=input.select-dropdown.active | |
[error] Element css=input.select-dropdown.active not found
[info] Test case failed
HTML
(it contains several drop-down lists):
<div class="row" _ngcontent-pkb-13="">
<div class="col s2" _ngcontent-pkb-13="">
<label for="groupBy" _ngcontent-pkb-13="">Agrupado por</label>
</div> <div class="col s5" _ngcontent-pkb-13="">
<div class="select-wrapper form-control ng-untouched ng-pristine ng-valid initialized">
<span class="caret">/span>
<input class="select-dropdown" readonly="true" data-activates="select- options-32184002-bd89-baf2-43b8-3d88ae8219e5" value="Todo el territorio" type="text"></input>
<ul id="select-options-32184002-bd89-baf2-43b8-3d88ae8219e5" class="dropdown-content select-dropdown ">
<li class=""><span>Todo el territorio</span></li><li class=""><span>Instalaciones Deportivas</span></li><li class=""><span>Parroquias</span></li><li class=""><span>Polígonos Industriales</span>
(it shows a small part)
How you could select any item from the drop down ?, eg. "Parroquias"
Thanks
From the code you've posted you don't need the '.active' on the end of the locator, it should just be 'css=input.select-dropdown' However if you have multiple dropdowns this may not be the most efficient way of targetting them if they'd all have the same class. If you have control over the code you may want to add id's onto the dropdowns and use that for your target
As for getting it working, I can't get a working example on my machine as for it to appear as a dropdown you'd need your css, as you've coded it to just be a list but the css formats it as a dropdown, rather than using the 'select' tag. Normally you'd use the 'Select' command in Selenium, targetted at the dropdown, rather than a click command but I'm not sure if it would work with the way this page is coded as I've not come accross it before (my instinct would be no) so it probably would be the click on the dropdown as you're trying, then a click on the specific list item.
Related
I am using laravel 4.2. Im learning laravel and find myself caught up in one problem and I have tried in many forums and I haven't found the answer anyware.
My problem is as follows:
I have this form embeded in a php view file:
{{Form::open(['route'=> 'home.store'])}}
<div class="container col-xs-5 ">
<form class="form-horizontal">
<div class="form-group col-xs-8">
<!-- Split button -->
<div class="btn-group">
<select name="country" class="btn btn-success dropdown-toggle" >
<option disabled selected>Escoger País</option>
<option>Argentina</option>
<option>Bolivia</option>
<option>Chile</option>
<option>Colombia</option>
<option>Costa Rica</option>
<option>Cuba</option>
<option>Ecuador</option>
<option>El Salvador</option>
<option>Guatemala</option>
<option>Honduras</option>
<option>México</option>
<option>Nicaragua</option>
<option>Panamá</option>
<option>Paraguay</option>
<option>Perú</option>
<option>Puerto Rico</option>
<option>Uruguay</option>
<option>Puerto Rico</option>
<option>República Dominicana</option>
<option>Venezuela</option>
</select>
</div>
</div>
</div>
{{Form::close()}}
Now, in home.store I have:
$user-> country = Input::get('country');
This is meant to be stored in a database table with a field named "country" that is of type ENUM with the same options as the form. It works perfectly when I pick options without ansi character codes. However when I choose the option that contains a spanish tilde (´),that is set in ansi code, they cannot get stored in the database.
Now, to check what is getting as input I used in home.store :
return Input::all();
And it ouputs:
{"_token":"ofyHW7ElogegKJwMXQL3HsbugCSnRxbtkm0GVQ8y","country":"Per\u00fa"}
I can recognize the problem as: acsii code ú is translated to java \u00fa.
I have checked everywhere in the framework (FormBuilder.php and HtmlBuilder.php)to see if something is being defined as java in laravel but everything is set to UTF-8, so as the database, and so as the meta tag in the html view (the browser is set to utf-8 too)
I would greatly appreciate anyone help on this.
Thank you so much.
I'm using Watir WebDriver with Firefox.
Here are two asserts for the same element. The first works, but not the second:
assert_match(/Please add user to GMT/, #browser.small(:class, "error").text)
assert_match(/Please add user to GMT/, #browser.div(:class, "eight mobile-three columns").small(:class, "error").text)
I need the second assert to work, because there are 8 error messages on the page, which are presented if the user does not populate 8 mandatory fields. All 8 errors have the identical HTML. So, I need to be able to step down from the parent.
Here is the HTML:
<div class="eight mobile-three columns">
<a id="btnAddUserToGMT" class="success radius button expand error" onclick="AddUserToGMT();" data-reveal-id="addToGMT" href="#"> … </a>
<small class="error" style="margin-top:0px;">
Please add user to GMT
</small>
</div>
Here is the error message:
Watir::Exception::UnknownObjectException: unable to locate element, using {:class=>"error", :tag_name=>"small"}
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/elements/element.rb:490:in `assert_exists'
C:/Ruby193/lib/ruby/gems/1.9.1/gems/watir-webdriver-0.6.4/lib/watir-webdriver/elements/element.rb:85:in `text'
C:/Documents and Settings/Asserts_01.rb:22:in `testBasic'
The complaint for the second assert is:
unable to locate element, using {:class=>"error", :tag_name=>"small"}
And yet that same using was OK for the first assert.
Problem solved.
After discussion with the developer, it appears that by some unusual manipulation of automatically generated HTML, the text of the error message appears at its correct location on the page. But the assertion must be based on a different tag, which is specified at some completely different position on the page.
For example, I was trying to assert on this code at the correct position:
<small class="error" style="margin-top:0px;">
Gender is required
</small
Even unique xPath generated by FirePath failed to find this.
What I should have asserted on was a HIDDEN tag on a completely different part of the page.
<input id="errorMsgGenderID" name="errorMsgGenderID" type="hidden" value="Gender is required" />
There were several such tags for each mandatory field that was not populated, all bunched together on the same line. They were all "input" tags, which puzzled me.
I have the HTML as
<li>
<div data-track="discovered_spots" data-filter="discovered_spots" class="button filter-button">
<span class="icon-compass"></span>
Discoveries (2)
</div>
</li>
I am trying to click the button link
#browser.div(:class =>'button filter-button').span(:text => ' Discoveries (2) ').click
Just not working or producing any errors.
I have also tried using the xpath
##browser.div(:xapth => "//div[#data-track='discovered_spots']").click
##browser.div(:text => "Discoveries").click
but that produce errors.
I have also viewed and tried the code present in other questions chains but none worked any help will be very useful.
Try:
#browser.div(:text, /Discoveries/).click
Regex for the attribute should hit the text. Not specifying \d anchor will cast a wider net in case that value of 2 fluctuates by only looking for the match of Discoveries in text and ignoring the number and parentheses.
I have a repeating component in wicked which needs to be added and deleted as per the user requirement. The maximum number of component is predefined. So I am adding the components at start up and hiding and showing based on need. I am required to change the arrangement of the components in the HTML markup when there is any deletion of the component. I use JavaScript for this. I want to know if wicket would lose hold of the components if I do this.
<div wicket:id="borrowerTabs" id="borrowerTabs">
<span wicket:id="borrowerTab1" id="borrowerTab1" ></span>
<span wicket:id="borrowerTab2" id="borrowerTab2" ></span>
<span wicket:id="borrowerTab3" id="borrowerTab3" ></span>
<span wicket:id="borrowerTab4" id="borrowerTab4" ></span>
<button wicket:id="addBorrower" id="addBorrower" type="button"></button>
<button wicket:id="deleteBorrower" id="deleteBorrower" onclick="updateUIForDeleteBorrower()" type="button"></button>
</div>
If delete the borrowerTab3, contents inside borrowerTab4 will be replacing the contents inside borrowerTab3 and the model objects too will be swapped though I do not do a target.add(borrowerTab3). Now while form submission, I am not getting the values of the fields inside borrowerTab3.
I'm not sure if it helps but try component.setVisible(false) in your java code to hide it.
I'm trying to use internal references to link an index atop my wiki page with several sections within the document. Here's an example:
* `My index`_
+ Foreword_
+ `Technical details`_
My index
--------
Foreword
~~~~~~~~
Technical details
~~~~~~~~~~~~~~~~~
If I generate the HTML page via rest2html I get the right result. However, GitHub wiki inserts extra words in the references and the links do not work. for example:
https://github.com/myaccount/myproject/wiki/Page#wiki-my-index
https://github.com/myaccount/myproject/wiki/Page#wiki-foreword
https://github.com/myaccount/myproject/wiki/Page#wiki-technical-details
I couldn't find any relevant document in the GitHub page, so I'm kind of lost.
It looks like the class ids are missing from the generated divs. Check the page source to (not) see them. I think this is what it should look like:
<ul>
<li><dl class="first docutils">
<dt><a class="reference internal" href="#my-index">My index</a></dt>
<li><a class="reference internal" href="#foreword">Foreword</a></li>
<li><a class="reference internal" href="#technical-details">Technical details</a></li>
</ul>
<div class="section" id="my-index">
<h1>My index</h1>
</div>
<div class="section" id="foreword">
<h2>Foreword</h2>
</div>
<div class="section" id="technical-details">
<h2>Technical details</h2>
</div>
Edit: User intuited mentions the same issue in a GitHub markup issue
I've noticed this problem with README.rst files as well. As well as
headings, inline targets in .rst files, e.g. _some target, don't
work. The inline target text gets wrapped in a but doesn't get
made into any sort of link target. Should I file this as a separate
issue?