While selecting radio button inside laravel Dusk i am getting
Facebook\WebDriver\Exception\ElementNotInteractableException: element
not interactable
Here is my code
$browser->visit('/test')
->radio('question_outer_3', '29')
->assertTitleContains('Test');
This is my templete
<input type="radio" class="radio user_questions " name="question_outer_3" id="option29" value="29" data-question="11" data-option="29" data-scroll-to=" #question_outer_4 ">
Often elements are "not interactable" when are not in the viewport (e.g. you have to scroll to reach them, or are still to be appended in the DOM after a Javascript call).
Scrolling and waiting for text may help.
Related
I'm trying to catch the click of a v-switch prior to it flipping to see if a preexisting condition has been met. While logging e.target of the event I am getting
<div class="v-input--selection-controls__ripple primary--text"></div>
as the result but every now and then I get
<input aria-checked="true" id="input-24" role="switch" type="checkbox" aria-disabled="false" value="Arizona">
Am I missing something in this or is this unexpected behavior?
Codepen Example
What is happening is that you're clicking on two different elements.
When you click on the ball or around it in the grey area you click on this element:
But when you click outside it but still inside the input you click on this other element:
However, both of then capture you click.
You could change your implementation to capture the change event:
<template v-slot:item.ia="{ item }">
<v-switch
v-model="ia_array"
:key="item.id"
:label="item.state"
:value="item.state"
#change="onChange"
></v-switch>
</template>
I'm trying to do test cases for my application on Laravel 6.0 with Dusk. I'm facing some difficulties in checkbox selection, it is not finding the 'check' element.
As per the documentation I have used the check method and defined the selector with id
My ID is : company-search-type-Investor and my code is:
$browser->scrollToElement('#company-search-type-Investor')
->assertNotChecked('#company-search-type-Investor')
->check('#company-search-type-Investor')
->pause(1000)
Its strange that my test with ->assertNotChecked('#company-search-type-Investor') gets passed but ->check('#company-search-type-Investor') gives an error:
Facebook\WebDriver\Exception\UnrecognizedExceptionException: element click intercepted: Element <input data-v-c1e51704="" id="company-search-type-Investor" type="checkbox"> is not clickable at point (192, 497). Other element would receive the click: <label data-v-c1e51704="" class="kt-checkbox" style="margin-bottom: 6px; font-size: 1.1rem;">...</label>
Any suggestions are welcomed. Thanks.
This could be happening because CSS is being applied that moves the checkbox behind the label. There are two ways to check the checkbox.
You can call click on the label:
$browser->click("label[data-v-c1e51704='']");
You can call sendKeys on the checkbox:
$browser->element("#company-search-type-Investor")->sendKeys(WebDriverKeys::SPACE)
We are re-designing a site and part of that re-design involves making the site accessible to screen readers and the like. I'm using latest version (2.8.0). Here's what's happening --- validation for all text, select and textarea fields in our forms work perfectly. In order to be accessible, checkbox and radio inputs are wrapped in tags. The html for a set of checkboxes looks like this:
<div class="form-group">
<p id="applicant_type_desc" style="margin-bottom: 6px;"><strong>I am: <span class="text-danger" aria-hidden="true">*</span><span class="sr-only">Required</span></strong> <em class="small">(check all that apply)</em></p>
<div class="checkbox">
<label id="applicant_type_patient_desc">
<input type="hidden" name="applicant_type_patient" id="" value="N">
<input type="checkbox" name="applicant_type_patient" id="applicant_type_patient" value="Y" {checked_applicant_type_patient} aria-labelledby="applicant_type_desc applicant_type_patient_desc" data-parsley-multiple="type" data-parsley-error-message="Please specify whether you are a patient, relative, employee or other.">
A patient
</label>
</div>
followed by more checkbox divs without error messages and ended with an end div for the for form-group wrapper.
If I load the form and click 'submit', all the text fields are validated properly. If I add 'required' to the checkbox above, when 'submit' is clicked nothing happens and the form is submitted with no validation at all.
The same thing happens when I try to validate a radio button set as required.
There is some custom jQuery and parsley code which creates a div to hold all the error messages and transforms the error messages into links to the field id so that a screen reader can follow them and focus on the field in error. But imho, this should have no effect on why the form validation doesn't kick in.
I'm absolutely baffled.
FYI - I tried this using an earlier version (2.0.3) of parsley and the validation actually worked, although all my custom error processing was ignored.
Any insight would be greatly appreciated.
As it turns out, parsley handles the errorswrapper element differently for text, textarea and selects then it does for checkboxes and radio buttons.
The starting wrapper element for text, textarea and select contains the parsley-data-id attribute whereas checkbox and radio button elements contain the parsley-data-multiple attribute whether that was generated by parsley or entered manually in the html.
My code was looking for parsley-data-id and, of course the jquery selector failed and generated an error. A colleague was able to spot this for me while we were looking at the page in chrome inspector. Once i saw the error, making a simple adjustment to the form:error event function allowed everything to work.
I'm experiencing a problem ONLY in Chrome where an Ajax response is not being displayed. Oddly, when I hover over the page's main menu, the response shows up and also stays when I move the mouse away again from the main menu.
Here is a more specific description:
The page contains a search box that allows the user to start typing a contact name. As the user types, an ajax request is made to return a list of suggested contacts. The user can then click on a radio button corresponding to a contact in that list to display all the contact information of that one person. Up to that point everything works fine. But now if the user goes back to the search box to change his search, the previously returned list of contacts goes away, but the new one from the new search does not show up. It is the click on the radio button that causes the following search not to display any ajax responses. The odd thing now is that the response does show up if the user hovers over the main menu at the top of the page (which uses css), and it also stays if the user moves the mouse away again from the menu and everything works fine afterwards. Here is the page structure:
<div id="fixedTopBar">
<?php
include("include/mainMenu.php");
?>
</div>
<div id="pageContent">
<div id="contactListContainer">
<form>
<input id="contactSearchBox" type="text" autocomplete="off" onkeyup="showHint(this.value, 'contactList', null , 'include/ajax/getContacts.php')">
</form>
<div id="contactList">
<form>
<?php
echoAllContacts(getContactsFromDatabase());
?>
</form>
</div>
</div>
<div id="profile"></div>
The ajax request is made with the showHint() function in the id="contactSearchBox" input, and the response is displayed within the id="contactList" div.
So in short, the click on a radio button causes the problem, and hovering over the top menu solves the problem (very strange no?).
Please let me know what other code you need to track down the problem if you have any ideas, or if anything I said did not make sense.
Thanks in advance!
I was able to solve my problem with some css:
The id="contactListContainer" div was positioned: fixed ...once I positioned it absolute, the problem was gone. Now, to actually position it fixed and not have the problem, I also had to add the position:fixed or position:absolute property to the child div id="contactList".
Hi i have the following simple radio button
<label>
<input type="radio" name="radioOption1" value="option1">
System option1.
</label>
How would i use selenium to verify the radio button and its label is not visible.
selenium.isVisible("//input[#name='radioOption1' and #value='option1']");
would verify if the option is not visible but i want to verify the whole label is not visible.
xpath has a parent pseudo-pointer, not so sure about Selenium implemetation
//parent::input[#name='radioOption1' and #value='option1']
or
//label[./input[#name='radioOption1' and #value='option1']]