Htmlunit重定向不起作用

时间:2017-11-16 16:48:33

标签: java htmlunit

我使用的是2.28版本,我在尝试点击a时遇到了一些问题 将我重定向到两次不同网址的按钮。

click方法的结果是UnexpectedPage ...(响应 状态代码200)。

我试图设置: webClient.getCache()setMaxSize(0)。 。webClient.getOptions()setRedirectEnabled(真);

但我无法访问该页面。我启用了JavaScript。

这是一个用PHP编写的网页 按钮目前正在执行此操作:

$.ajax({
url: '{{ action('LoanController@checkLoanProcessed') }}',
data: data,
type: 'POST',
cache: false,
dataType: "json",
success: function(data) {
if (data.status === true && data.processed === true)
{ 
  clearInterval(interval); window.location.href = data.redirect; }    
}
});
};

有任何线索吗?

HTML

<script>var SITE_URL = 'https://staging.tutasa.com.uy/';</script>


<script type="text/javascript">
var user_id = '49095';
var user_first_name = 'JUAN';
var duration_6 = "6 Months";
var duration_1 = '1 Year';
var duration_2 = '2 Years';
var duration_3 = '3 Years';
var duration_4 = '4 Years';

var duration_6_quota = '6 Quotas';
var duration_1_quota = '12 Quotas';
var duration_2_quota = '24 Quotas';
var duration_3_quota = '36 Quotas';
var duration_4_quota = '48 Quotas';

var quota_label = [];
quota_label['quota_0'] = '6 Monthly Quotas of:';
quota_label['quota_1'] = '12 Monthly Quotas of:';
quota_label['quota_2'] = '24 Monthly Quotas of:';
quota_label['quota_3'] ='36 Monthly Quotas of:';
quota_label['quota_4'] = '48 Monthly Quotas of:';
var borrower_page = true;
var lender_page = false;

</script>

<!doctype html>
<html lang="en">
	<head>
		<meta charset="utf-8">
		<meta http-equiv="X-UA-Compatible" content="IE=edge">
		<meta name="viewport" content="width=device-width, initial-scale=1">
		                    <title>
                            TuTasa - Your Account                    </title>		



<link rel="stylesheet" type="text/css" href="https://staging.tutasa.com.uy/layouts/css/bootstrap.css">
<link rel="stylesheet" type="text/css" href="https://staging.tutasa.com.uy/layouts/css/datepicker3.css">
<link rel="stylesheet" type="text/css" href="https://staging.tutasa.com.uy/css/app.css?1512484810">
<link rel="stylesheet" type="text/css" href="https://staging.tutasa.com.uy/css/app2.css?1512484810">
<link rel="stylesheet" type="text/css" href="https://staging.tutasa.com.uy/layouts/css/bootstrap-slider.css">
<link href="https://maxcdn.bootstrapcdn.com/font-awesome/4.4.0/css/font-awesome.min.css" rel="stylesheet"/>
<script src="https://staging.tutasa.com.uy/layouts/js/jquery.min.js"></script>
 

		<script type="text/javascript">
			
            var CURRENCY_SYMBOL = '$U';
            var CURRENCY_THOUSAND_SEP = ',';
            var CURRENCY_DEC_POINT = '.';
            var THOUSAND_SEP = ',';
            var DEC_POINT = '.';
        
		</script>	

	

	</head>
	<body>                                  
                      
            <div id="wrap" class="container-fluid">
                                <div id="main" class="row clearfix">
                                            <div class="col-sm-offset-2 col-sm-8 col-md-offset-1 col-md-10 main">
                            <div class="container-fluid create-new-loan ">
    <div class="panel panel-default">
        <div class="panel-body pl0 pr0">

            <div class="row bs-wizard" style="border-bottom:0;">
                <div class="col-xs-3 bs-wizard-step complete">
                    <div class="progress"><div class="progress-bar"></div></div>
                    <a href="#" class="bs-wizard-dot">1</a>
                    <div class="text-center bs-wizard-stepnum">1. Personal</div>
                </div>
                <div class="col-xs-3 bs-wizard-step active"><!-- complete -->

                    <div class="progress"><div class="progress-bar"></div></div>
                    <a href="#" class="bs-wizard-dot">2</a>
                    <div class="text-center bs-wizard-stepnum">2. Income</div>
                </div>
                <div class="col-xs-3 bs-wizard-step disabled"><!-- complete -->

                    <div class="progress"><div class="progress-bar"></div></div>
                    <a href="#" class="bs-wizard-dot">3</a>
                    <div class="text-center bs-wizard-stepnum">3. Decision</div>
                </div>
                <div class="col-xs-3 bs-wizard-step disabled"><!-- active -->

                    <div class="progress"><div class="progress-bar"></div></div>
                    <a href="#" class="bs-wizard-dot">4</a>
                    <div class="text-center bs-wizard-stepnum">4. Money</div>
                </div>
            </div>


            <form method="POST" action="https://staging.tutasa.com.uy/loan/create" accept-charset="UTF-8" class="form-horizontal"><input name="_token" type="hidden" value="BXLImooTL1DnEn4ouSi4uCJ1GG4fZawTdRkRzDtG">
            <input name="int" type="hidden" value="">
            <input name="user_id" type="hidden" value="49095">
            <input name="type" type="hidden" value="borrower">
            <div class="panel panel-default hidden">
                <div class="panel-heading">Income</div>
                <div class="panel-body">
                    <input type="hidden" name="borrow_amount_min" value="10000.00"/>
                    <input type="hidden" name="borrow_amount_max" value="200000.00"/>
                                        
                        <div class="form-group">
                            <label for="education" class="col-sm-4 control-label">Education<span class="required"> *</span></label>
                            <div class="col-sm-4">
                                <select class="form-control" id="education" name="education"><option value=""></option><option value="1">Primary</option><option value="2">Secondary</option><option value="3">University</option><option value="4" selected="selected">Post Graduate</option><option value="5">Other</option></select>
                            </div>
                        </div>
  

                    <div class="form-group">
                        <label for="income_type" class="col-sm-4 control-label">Means of Income<span class="required"> *</span></label>
                        <div class="col-sm-4">
                            <select class="form-control" id="income_type" name="income_type"><option value=""></option><option value="1">Employee</option><option value="2">Businessman</option><option value="3">Independent Professional</option><option value="4">Pension</option><option value="5">Allowances</option><option value="6" selected="selected">Rent</option><option value="7">Unemployed</option></select>
                        </div>
                    </div>


                    <div class="hidden income-employee income-1">
                        <div class="form-group">
                            <label for="company_name" class="col-sm-4 control-label">Company Name<span class="required"> *</span></label>
                            <div class="col-sm-4">
                                <input class="form-control" name="company_name" type="text" value="" id="company_name">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="job_title" class="col-sm-4 control-label">Job Title</label>
                            <div class="col-sm-4">
                                <input class="form-control" name="job_title" type="text" value="" id="job_title">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="company_phone_no" class="col-sm-4 control-label">Company telephone number<span class="required"> *</span></label>
                            <div class="col-sm-4">
                                <input class="form-control" name="company_phone_no" type="text" value="" id="company_phone_no">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="company_supervisor" class="col-sm-4 control-label">Name of Supervisor<span class="required"> *</span></label>
                            <div class="col-sm-4">
                                <input class="form-control" name="company_supervisor" type="text" value="" id="company_supervisor">
                            </div>
                        </div>
                        <div class="form-group">
                            <label for="job_duration" class="col-sm-4 control-label">How long have you been with this job?<span class="required"> *</span></label>
                            <div class="col-sm-4">
                                <select class="form-control" id="job_duration" name="job_duration"><option value="6" selected="selected">Less then 6 months</option><option value="12">6 months to 1 year</option><option value="24">1 year to 2 years</option><option value="36">2 years to 3 years</option><option value="37">More than 3 years</option></select>
                            </div>
                        </div>
                    </div>           

                    
                    <div class="form-group">
                        <label for="monthly_income" class="col-sm-4 control-label">What's your monthly net income?<span class="required"> *</span></label>
                        <div class="col-sm-4">
                            <input class="form-control" name="monthly_income" type="text" value="350000" id="monthly_income">
                        </div>
                        <div class="col-sm-4">
                            <label class="disclosure">Need to show proof of income</label>
                        </div>
                    </div>

                    <div class="form-group">
                        <div class="col-sm-4"></div>
                        <div class="col-sm-4">
                            <input class="form-control" id="monthly_income_text" readonly="true" name="monthly_income_text" type="text" value="Trescientos cincuenta mil">
                        </div>
                    </div>

                                        <div class="form-group">
                        <label for="proof_of_income" class="col-sm-4 control-label">Do you have proof of income?<span class="required"> *</span></label>
                        <div class="col-sm-4">
                            <select class="form-control" id="proof_of_income" name="proof_of_income"><option value="Select">Select</option><option value="Yes" selected="selected">Yes</option><option value="No">No</option><option value="Maybe">Maybe</option></select>
                        </div>
                    </div>              
        
                    <div class="form-group">
                        <label for="bank_account" class="col-sm-4 control-label">Do you have bank account under your name?<span class="required"> *</span></label>
                        <div class="col-sm-4">
                            <select class="form-control" id="bank_account" name="bank_account"><option value="Select">Select</option><option value="Yes" selected="selected">Yes</option><option value="No">No</option><option value="Yes, but I don&#039;t remember the details">Yes, but don&#039;t remember details</option></select>
                        </div>
                    </div>

                    <input type="hidden" name="calculate_status" class="form-control" value="1" />
                    <div class="form-group">
                        <div class="col-sm-4 col-sm-offset-3">
                            <input class="btn btn-primary btn-lg" name="calculate" type="submit" value="How much can I borrow?">
                        </div>
                    </div>
                        
                </div>
            </div>
            
            <input name="temp_amount" type="hidden" value="30000.0000">
            <input name="temp_duration" type="hidden" value="0">
                            <div class="panel panel-default loan_amt_duration">
                    <div class="panel-heading">
                        Find below the maximum you can borrow based on the information provided.
                    </div>

                    <div class="panel-body">
                       
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="col-sm-12">
                                    <h3>
                                        Amount
                                    </h3>
                                </div>
                            </div>
                        </div>
                        
                                                
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="col-sm-10 mt-15">
                                    <a class="amountSliderDecrease" href="#">
                                        <span class="glyphicon glyphicon-minus mr-15"></span>
                                    </a>
                                    <input id="amount" name="amount" data-slider-id='amountSlider' data-slider-class="slider-long" type="text" data-slider-min="10000.00" data-slider-max="200000.00" data-slider-step="10000" data-slider-value="30000.0000"/>
                                    <a class="amountSliderIncrease" href="#">
                                        <span class="glyphicon glyphicon-plus ml-15"></span>
                                    </a>
                                </div>
                                <div class="col-sm-2 mt-15">
                                    <input id="amount-manual-loan" name="amount-manual" class="amount-manual text-center" min="10000.00" max="200000.00"/>
                                </div>
                            </div>
                        </div>
                            
                        <div class="row">
                            <div class="col-sm-12">
                                <div class="col-sm-12">
                                    <h3>
                                        Loan Duration
                                    </h3>
                                </div>
                            </div>
                        </div>

                        <div class="row">
                            <div class="col-sm-12">
                                <div class="col-sm-10 mt-15">
                                    <a class="durationSliderDecrease" href="#">
                                        <span class="glyphicon glyphicon-minus mr-15"></span>
                                    </a>
                                    <input id="duration" name="duration" data-slider-id='durationSlider' type="text" data-slider-min="0" data-slider-max="4" data-slider-step="1" data-slider-value="0"/>
                                    <a class="durationSliderIncrease" href="#">
                                        <span class="glyphicon glyphicon-plus ml-15"></span>
                                    </a>
                                </div>
                            </div>
                        </div>

                        <div class="pt-40 col-sm-12">
                            <div class="row totals">
                                <div id="borrower-data-url" data-url="https://staging.tutasa.com.uy/borrower/repayment-calculate" class="hide"></div>
                                <div class="col-md-3 mb-25 selected-result">                                                
                                    <span id="borrow_amount">$U 30,000</span>
                                    <span class="amt_label">Total Amount</span>
                                </div>
                                <div class="col-md-3 mb-25 selected-result">
                                    <span class="borrow_quota_display">$U 6,171</span>
                                    <span id="borrow_quota_label" class="amt_label">
                                        6 Monthly Quotas of:<sup>*</sup>
                                    </span>
                                </div>
                                <div class="col-md-3 mb-25 selected-result">
                                    <span class="borrow_rate_display">30.84%</span>
                                    <span class="amt_label">Interest Rate</span>
                                </div>
                                <div class="col-md-3 mb-25">
                                    <button id="credit_score" onClick="void(0)" style="cursor:pointer;" class="btn btn-block btn-success btn-lg col-sm-12" name="review" type="submit" value="Proceed to credit scoring">Proceed to credit scoring</button>
                                    <button id="credit_score" onClick="void(0)" style="cursor:pointer; margin-top:15px;" class="btn btn-block btn-primary btn-lg col-sm-12" name="back_to_income" type="submit" value="Back">Back</button>
                                </div>
                                <input name="borrow_quota" type="hidden" value="6171">
                            </div>
                        </div>    
                    </div>
                </div>
                        </form>
    
        </div>
    </div>
        <p>*Representative APR  <span id="borrow_rate" class="borrow_rate borrow_rate_display">30.84</span>%. Terms subject to market conditions.</p>
    </div>

<script type="text/javascript">
$(document).ready(function(){
    
    if(false){
        $('input[name="calculate"]').click();
    }
    
    $('#monthly_income').inputmask('[999999999]', {"numericInput": true, "greedy": false, "placeholder": ""});

    $('#monthly_income').on('keyup', _.debounce(function(){
        monthlyIncomeText();
    }, 1000));
    
    _.each(['input[name="borrow_quota"]','#purpose','#education','#priority','#income_type','#company_name','#job_title','#company_phone_no','#company_supervisor','#job_duration','#businessman_org_name',
            '#businessman_org_phone','#businessman_ref','#indep_prof_industry','#indep_prof_ref','#indep_prof_ref_phone','#retired_prev_employer_name','#allow_grantor','#unemp_prev_employer_name',
            '#monthly_income','#proof_of_income','#bank_account','#repayment_likelihood','#calculate_status','#fast_track_code','#fast_track_code_status','#amount_payable_to'], function(input){
                $(input).change(function(){
                    var data = {};
                    if($('#amount').val()) data[btoa('amount')] = btoa($('#amount').val());
                    if($('#duration').val()) data[btoa('duration')] = btoa($('#duration').val());
                    if($('#borrow_rate').text()) data[btoa('rate')] = btoa($('#borrow_rate').text());
                    if($('input[name="borrow_quota"]').val()) data[btoa('quota')] = btoa($('input[name="borrow_quota"]').val());
                    if($('input[name="borrow_quota"]').val()) data[btoa('total')] = btoa($('#duration').val() ? 0.5 * 12 * $('input[name="borrow_quota"]').val() : $('#duration').val() * $('input[name="borrow_quota"]').val());
                    if($('#education').val()) data[btoa('education')] = btoa($('#education').val());
                    if($('#priority').val()) data[btoa('priority')] = btoa($('#priority').val());
                    if($('#income_type').val()) data[btoa('income_type')] = btoa($('#income_type').val());
                    if($('#monthly_income').val()) data[btoa('monthly_income')] = btoa($('#monthly_income').val());
                    if($('#proof_of_income').val()) data[btoa('proof_of_income')] = btoa($('#proof_of_income').val());
                    if($('#proof_of_income').val()) data[btoa('proof_of_income')] = btoa($('#proof_of_income').val());
                    if($('#bank_account').val()) data[btoa('bank_account')] = btoa($('#bank_account').val());
                    if(input.indexOf('#') != -1){
                        data[btoa(input.replace('#', ''))] = btoa($(input).val());
                    }
                    data[btoa('user_id')] = btoa(49095);
                    data[btoa('type')] = btoa('borrower');
                    data['_token'] = $('form').find('input[name="_token"]').val();
                    $.ajax({
                        url: 'https://staging.tutasa.com.uy/loan/save-temp-loan',
                        data: data,
                        type: 'POST',
                        cache: false,
                        dataType: "json"
                    });
                });
            });

    $('#fast_track_code_status').val('');
    $('.fast_track_code_error').hide();
    if($('#fast_track_code').val() != '') {
        if($('#fast_track_code_apply').length > 0) {
            $( "#fast_track_code_apply" ).trigger( "click" );
        }
    }
        
    function showIncomeFields(){
        $('.income-employee').addClass('hidden');
        $('.income-businessman').addClass('hidden');
        $('.income-independent-professional').addClass('hidden');
        $('.income-retired').addClass('hidden');
        $('.income-allowances').addClass('hidden');
        $('.income-rent').addClass('hidden');
        $('.income-unemployed').addClass('hidden');
        $('.income-'+$('#income_type').val()).removeClass('hidden');
    }

    showIncomeFields();

    $('#income_type').change(function(){
        showIncomeFields();
    });
    
    function monthlyIncomeText(){
        console.log($('#monthly_income').val());
        if($('#monthly_income').length && $.isNumeric($('#monthly_income').val()) && $('#monthly_income').val() > 0){
            var data = {};
            data[btoa('number')] = btoa($('#monthly_income').val());
            data['_token'] = $('form').find('input[name="_token"]').val();
            $.ajax({
                url: 'https://staging.tutasa.com.uy/borrower/numbers-to-words',
                data: data,
                type: 'POST',
                cache: false,
                dataType: "json",
                success: function(data) {
                    console.log(data);
                    if (data.status === true) {
                        $('#monthly_income_text').val(data.text.substr(0,1).toUpperCase() + data.text.substr(1));
                    }else{
                        $('#monthly_income_text').val('');
                    }
                },
                error: function(error) {
                    console.log(error);
                    $('#monthly_income_text').val('');
                }
            });
        }else{
            $('#monthly_income_text').val('');
        }
    }
    
    monthlyIncomeText();
    
    });
</script>
                        </div>
                                    </div>
                            </div>
           
<script src="https://staging.tutasa.com.uy/js/underscore-min.js"></script>
<script src="https://staging.tutasa.com.uy/js/pdf/build/pdf.js"></script>
<script src="https://staging.tutasa.com.uy/layouts/js/bootstrap.js"></script>
<script src="https://staging.tutasa.com.uy/layouts/js/bootstrap-datepicker.js"></script>
<script src="https://staging.tutasa.com.uy/layouts/js/angular.min.js"></script>
<script src="https://staging.tutasa.com.uy/js/bootbox.min.js"></script>
<script src="https://staging.tutasa.com.uy/layouts/js/bootstrap-slider.js"></script>
<script src="https://staging.tutasa.com.uy/layouts/js/heartcode-canvasloader-min.js"></script>
<script src="https://staging.tutasa.com.uy/js/inputmask/inputmask.js"></script>
<script src="https://staging.tutasa.com.uy/js/inputmask/jquery.inputmask.js"></script>
<script src="https://staging.tutasa.com.uy/js/inputmask/inputmask.numeric.extensions.js"></script>
<script src="https://staging.tutasa.com.uy/js/sliders.js?1512484810"></script>
<script src="https://staging.tutasa.com.uy/js/scripts.js?1512484810"></script>
  
	</body>

</html>

0 个答案:

没有答案