How to execute a python(selenium) script on clicking run button in the template view. Django

classic Classic list List threaded Threaded
2 messages Options
Reply | Threaded
Open this post in threaded view
|

How to execute a python(selenium) script on clicking run button in the template view. Django

Dimple Mathew
Once i select options in the drop-down, the scripts should be executed.
Index.html
 <div class="col-xs-5 selectContainer">
<select name="colors" class="form-control" multiple title="Choose Script">
<option value="black" onclick="goPython()">US BANK</option>
<option value="blue">BOKF</option>
<option value="green">COMMERCE BANK</option>
<option value="orange">MICHIAS</option>
<option value="red">TD BANK</option>
<option value="yellow">WELSFARGO</option>
<option value="white">BOA</option>
</select>
</div>
</div>


<script>
function goPython(){
$.ajax({
url: "C:\mydjango\website\automation\script\USBANK.py",
}).done(function() {
alert('finished python script');;
});
}

Views.py

def lockbox(request):
return render(request,'automation/lockbox.html')

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/07cc9e80-d30f-4578-82b5-abe38cff45ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.
Reply | Threaded
Open this post in threaded view
|

Re: How to execute a python(selenium) script on clicking run button in the template view. Django

Julio Biason-3
Hi Dimple,

Your `url` is invalid. Views are exposed to the world via urls; in that, you define which URL will call which view.

If you're running Django on your machine, your URL should probably start with 'http://localhost:8000/the/url/for/your/view' -- although the `http` can be omitted, in which case the browser will use the current schema and `://localhost` can also be omitted, in which case the browser will request from the current server.

On Mon, Jun 11, 2018 at 6:43 AM, Dimple Mathew <[hidden email]> wrote:
Once i select options in the drop-down, the scripts should be executed.
Index.html
 <div class="col-xs-5 selectContainer">
<select name="colors" class="form-control" multiple title="Choose Script">
<option value="black" onclick="goPython()">US BANK</option>
<option value="blue">BOKF</option>
<option value="green">COMMERCE BANK</option>
<option value="orange">MICHIAS</option>
<option value="red">TD BANK</option>
<option value="yellow">WELSFARGO</option>
<option value="white">BOA</option>
</select>
</div>
</div>


<script>
function goPython(){
$.ajax({
url: "C:\mydjango\website\automation\script\USBANK.py",
}).done(function() {
alert('finished python script');;
});
}

Views.py

def lockbox(request):
return render(request,'automation/lockbox.html')

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/07cc9e80-d30f-4578-82b5-abe38cff45ed%40googlegroups.com.
For more options, visit https://groups.google.com/d/optout.



--
Julio Biason, Sofware Engineer
AZION  |  Deliver. Accelerate. Protect.
Office: <a href="callto:+555130838101" value="+555130838101" style="color:rgb(17,85,204);font-family:arial,sans-serif;font-size:12.8px" target="_blank">+55 51 3083 8101  |  Mobile: <a href="callto:+5551996209291" style="color:rgb(17,85,204)" target="_blank">+55 51 99907 0554

--
You received this message because you are subscribed to the Google Groups "Django users" group.
To unsubscribe from this group and stop receiving emails from it, send an email to [hidden email].
To post to this group, send email to [hidden email].
Visit this group at https://groups.google.com/group/django-users.
To view this discussion on the web visit https://groups.google.com/d/msgid/django-users/CAEM7gE2%3D9r_Qm9UpqJfRKYJNmYJD0Az3JxusJT4cWNeh1NBxVg%40mail.gmail.com.
For more options, visit https://groups.google.com/d/optout.