Unable to click the dropdown button - python-2.7

I am trying to click the drop-down element.
My HTML:
<select id="ctl00_ContentPlaceHolder1_gv_ctl28_PageDropDownList" style="width:80px;" onchange="javascript:setTimeout('__doPostBack(\'ctl00$ContentPlaceHolder1$gv$ctl28$PageDropDownList\',\'\')', 0)" name="ctl00$ContentPlaceHolder1$gv$ctl28$PageDropDownList">
<option value="1">1</option>
<option value="2">2</option>
<option value="3">3</option>
Note: Unable to click the "__doPostBack" using scrapy/python.

I think you should try this
FormRequest.from_response()
use the submit button's name/id as the value for "__EVENTTARGET" in the formdata.

Related

Laravel Livewre: on select change, pass the selected value into the method in wire:change

i have this select tag on Livewire component:
<select
class="form-select deliveryGuySelect"
id="order-{{THIS_NEED_TO_BE_$dg->id}}"
wire:change="assignOrder({{$order->id}})"
>
#foreach($deliveryGuys as $dg)
<option value="{{$dg->id}}" wire:key="{{$dg->id}}">{{$dg->name}}</option>
#endforeach
</select>
And I need, on assignOrder() action from select tag, to send the option value as parameter $dg->id.
How can I do that?
Livewire and Alpine together expose the $event magic action-object, which can target the option that was selected, and the value it has, by using $event.target.value
<select wire:change="setSomeProperty($event.target.value)">
<!-- Options here -->
</select>
https://laravel-livewire.com/docs/2.x/actions#magic-actions

Scrolling and selecting a checkbox in a drop down using python webdriver

I have to select a checkbox from within a drop down. The problem is the value is not visible. I need to scroll down to reach the value.
html
<select class="select_box" tabindex="25" id="cbo_CC_CType"
name="cbo_CC_CType" multiple="multiple" multi-select="true"
autofillkey="CMDTYPE" title="COMMAND TYPE">
<option value="Authorization">Authorization</option>
<option value="Cancel">Cancel</option>
<option value="Change">Change</option>
<option value="Clear">Clear</option>
<option value="Final">Final</option>
<option value="Final1">Final</option>
<option value="Fina2">Final</option>
<option value="Fina3">Final</option>
.
.
.
.
.
.
<option value="MyCar">MyCar</option>
</select>
I tried:
chromedriver.find_element_by_xpath("//select[#id='cbo_CC_CType']/option[#value='MyCar']").click()
Can someone please help

How to dynamically preset/select the value of a html select object using Django?

This is the html file
<label for="caller">Caller</label>
<select name="caller">
<option value="20">20</option>
<option value="21">21</option>
<option value="22">22</option>
</select>
I want to dynamically preset the value of the caller. How can I do that?
E.G sometimes I want it to be 20, sometimes it can be 22. The value I want to send is stored in a variable and available as {{caller}}
You are passing caller from view function to template and you are trying to show default selected value then use selected="selected"
<option {% if caller == "20" %}selected="selected"{% endif %}>20</option>

jQuery Mobile- change the style of basic drop down select menu

I have to change the style of the following dropdown select menu:
<form>
<div class="ui-field-contain">
<label for="select-native-1">Basic:</label>
<select name="select-native-1" id="select-native-1">
<option value="1">The 1st Option</option>
<option value="2">The 2nd Option</option>
<option value="3">The 3rd Option</option>
<option value="4">The 4th Option</option>
</select>
</div>
</form>
all the option should display as list under the label (like Accordion list)

Transfer Value from drop down to a

I need some help ...
I need the location drop down box to determine the appropriate inbox the form should be sent to.
ex if I choose Houston from the drop down box it will send it to the PayrollUSA email.
Im currently using a radio button to make the selection but i would like to automate with the drop down.
Im pretty new to this but im sure theres a if statement that can tie them together...
im using .asp for this.
<input type="radio" name="payroll" value="PayrollUSA#mail.com" checked="checked">US Payroll
<input type="radio" name="payroll" value="PayrollCAN#mail.com">CAN Payroll
<input type="radio" name="payroll" value="PayrollUK#mail.com">UK Payroll
<input type="radio" name="payroll" value="PayrollHK#mail.com">HK Payroll
Drop down selection
<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
<option selected >Select</option>
<OPTION>Calgary</OPTION>
<OPTION>Chicago</OPTION>
<OPTION>Hong Kong</OPTION>
<OPTION>Houston</OPTION>
<OPTION>London</OPTION>
<OPTION>Los Angeles</OPTION>
<OPTION>Montreal</OPTION>
<OPTION>New York</OPTION>
<OPTION>New York Corporate</OPTION>
<OPTION>Philadelphia</OPTION>
<OPTION>San Francisco</OPTION>
<OPTION>Toronto</OPTION>
<OPTION>Toronto Corporate</OPTION>
<OPTION>Vancouver</OPTION>
</SELECT>
If you need the option value to be held then try this:
<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
<option value="">Select an Option</option>
<option <% if Business_Unit= "PayrollCAN#mail.com" then %> selected <% End if %> value="PayrollCAN#mail.com">Calgary</option>
<option <% if Business_Unit= "PayrollUSA#mail.com" then %> selected <% End if %> value="PayrollUSA#mail.com">Chicago</option>
</select>
etc. for each option and same value may be used for different option displays
I imaging this should just be html based. So your option menu should look like:
<SELECT SIZE="1" NAME="Business_Unit" style="width: 205px;" class="answers">
<option value="-1">Select an Option</option>
<OPTION value="PayrollCAN#mail.com">Calgary</OPTION>
<OPTION value="PayrollUSA#mail.com">Chicago</OPTION>
<OPTION value="PayrollHK#mail.com">Hong Kong</OPTION>
<OPTION value="PayrollUSA#mail.com">Houston</OPTION>
<OPTION value="PayrollUK#mail.com">London</OPTION>
<OPTION value="PayrollUSA#mail.com">Los Angeles</OPTION>
<OPTION value="PayrollCAN#mail.com">Montreal</OPTION>
<OPTION value="PayrollUSA#mail.com">New York</OPTION>
<OPTION value="PayrollUSA#mail.com">New York Corporate</OPTION>
<OPTION value="PayrollUSA#mail.com">Philadelphia</OPTION>
<OPTION value="PayrollUSA#mail.com">San Francisco</OPTION>
<OPTION value="PayrollCAN#mail.com">Toronto</OPTION>
<OPTION value="PayrollCAN#mail.com">Toronto Corporate</OPTION>
<OPTION value="PayrollCAN#mail.com">Vancouver</OPTION>
</SELECT>
You can use the same value multiple times if needed