简体   繁体   English

哪种方法适合Java中的这种情况?

[英]Which method is suitable for this scenario in Java?

Currently working on Selenium WebDriver and code had been written in Java . 目前正在使用Selenium WebDriver,并且代码已用Java编写。

The Scenario is If i select the drop down value = Month range or Date Range or Week Range then the related drop down will populate (ie if month Range is selected the From month and To month will be populated, if Date Range is selected the From Date and To Date will be populated, if Week Range is selected the From week and To week will be populated). 方案是:如果我选择下拉值=月范围或日期范围或周范围,则将填充相关的下拉列表(即,如果选择了月范围,则从月起而到月将填充,如果选择了日期范围,则从如果选择了周范围,则将填充日期和截止日期。

What Exactly i want to check whether if the Month Range drop down value is selected in the Period drop down then verify the related drop down that is From month and To month is populating. 究竟我想检查是否在“期间”下拉列表中选择了“月份范围”下拉值,然后验证是否填充了“从月份”和“到月份”相关的下拉列表。

Please anyone can help me for this secnario. 请任何人都可以为我提供帮助。 The HTML for Period: 期间的HTML:

<select id="periodId" name="period" style="display: none;">
<option value="l4w">Last 4 Weeks</option>
<option value="l52w">Last 52 Weeks</option>
<option value="daterange">Date Range</option>
<option value="weekrange">Week Range</option>
<option selected="" value="monthrange">Month Range</option>
<option value="yeartodate">Year To Date</option>
</select>

Once the week range is selected it need to select the below The HTML for WeekRange: 选择星期范围后,需要选择以下The WeekRange的HTML:

<dt id="week-label">
<dd id="week-element">
<select id="fromWeekYear" style="width:60px" name="fromWeekYear">
<option value="2010"> 2010</option>
<option value="2011"> 2011</option>
<option value="2012"> 2012</option>
<option value="2013"> 2013</option>
<option selected="" value="2014"> 2014</option>
</select>
<select id="fromWeek" style="width:60px" name="fromWeek">
<option value="1"> W 1</option>
<option value="2"> W 2</option>
<option value="3"> W 3</option>
<option value="4"> W 4</option>
<option value="5"> W 5</option>
<option value="6"> W 6</option>
<option value="7"> W 7</option>
<option value="8"> W 8</option>
<option value="9"> W 9</option>
<option selected="" value="10"> W 10</option>
<option value="11"> W 11</option>
<option value="12"> W 12</option>
<option value="13"> W 13</option>
<option value="14"> W 14</option>
<option value="15"> W 15</option>
<option value="16"> W 16</option>
<option value="17"> W 17</option>
<option value="18"> W 18</option>
<option value="19"> W 19</option>
<option value="20"> W 20</option>
<option value="21"> W 21</option>
<option value="22"> W 22</option>
<option value="23"> W 23</option>
<option value="24"> W 24</option>
<option value="25"> W 25</option>
<option value="26"> W 26</option>
<option value="27"> W 27</option>
<option value="28"> W 28</option>
<option value="29"> W 29</option>
<option value="30"> W 30</option>
<option value="31"> W 31</option>
<option value="32"> W 32</option>
<option value="33"> W 33</option>
<option value="34"> W 34</option>
<option value="35"> W 35</option>
<option value="36"> W 36</option>
<option value="37"> W 37</option>
<option value="38"> W 38</option>
<option value="39"> W 39</option>
<option value="40"> W 40</option>
<option value="41"> W 41</option>
<option value="42"> W 42</option>
<option value="43"> W 43</option>
<option value="44"> W 44</option>
<option value="45"> W 45</option>
<option value="46"> W 46</option>
<option value="47"> W 47</option>
<option value="48"> W 48</option>
<option value="49"> W 49</option>
<option value="50"> W 50</option>
<option value="51"> W 51</option>
<option value="52"> W 52</option>
<option value="53"> W 53</option>
</select>
</dd>
<dd> </dd>
<dd> </dd>

第一过滤器部分

Based on the Selection of the 1st filter option(ie WeekRange) 2nd filter (From Week to To Week is appearing as follows: 基于第一个过滤器选项的选择(即WeekRange),第二个过滤器(从周到周)显示如下:

第二过滤器部分

In javascript you have to write like below code.

var type = $("#periodId").val();

if(type == "weekrange"){

// then put java script to hide the related element/select boxes.

}else if(){

// then put java script to hide the related element/select boxes.

}else{

 // then put java script to hide the related element/select boxes.

}

声明:本站的技术帖子网页,遵循CC BY-SA 4.0协议,如果您需要转载,请注明本站网址或者原文地址。任何问题请咨询:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM