i am trying to send values to tag-text using c# selenium. tried different scenarios but could not. can any one help me?
<div class="list">
<div class="darkTag">
<div class="contents">
<span class="tag-text">Tamil</span>
<div class="tag-remove">x</div>
</div>
<div class="tag-bg" style="background: rgb(255, 87, 51);"></div>
</div>
</div>
Related
I have something like the following:
<div class="outer" ondragover="event.preventDefault();">
#foreach (CustomObject o in ObjectList)
{
<div draggable="true" #key="o.Rank" #ondrag="#(()=> StartDrag(o))" #ondrop="#(()=> Drop(o))" class="inner">
<textarea></textarea>
<input type="text">
<button></button>
<textarea></textarea>
</div>
}
</div>
I want to be able to drag and drop the whole section but the problem is that it stops allowing the highlighting of text within a text area or text box.
Is there a good way of allowing for highlighting of text and being able to drag/drop everything?
Try using these settings on inner elements
<div draggable="true" #key="o.Rank" #ondrag="#(()=> StartDrag(o))" #ondrop="#(()=> Drop(o))" class="inner">
<textarea draggable="true"
ondragstart="event.preventDefault();
event.stopPropagation();"></textarea>
<input type="text" draggable="true"
ondragstart="event.preventDefault();
event.stopPropagation();">
<button draggable="true"
ondragstart="event.preventDefault();
event.stopPropagation();"></button>
<textarea draggable="true"
ondragstart="event.preventDefault();
event.stopPropagation();"></textarea>
</div>
I'm trying to scrape data from web site with HtmlAgilityPack. One site has this structure:
<footer id="footer-index"><div class="container-fluid bg-dark-blue">
<div class="container bg-dark-blue text-white">
<div class="col-12 col-lg-3">
<p>
<strong>XXXX</strong>
<br>viale XXXXXXX
<br>12345 XXXXXX
<br>CF/P.IVA XXXXXXXXXXXXX
</p>
<p>Tel <a class="text-white" href="tel:+3912345">+39 123456</a></p>
<p class="text-white">Fax +39 123456</p>
</div>
<div class="col-12 col-lg-3 d-print-none">
<p>Informativa su Privacy e Cookie</p>
</div>
<div class="col-12 col-lg-3">
<p>Copyright 2018 XXXXX<br>Tutti i diritti riservati.</p>
</div>
</div>
</div>
</div>
</footer>
I can capture footer element with
pageDocument.DocumentNode.SelectSingleNode("//footer");
but the content of the footer is not captured. There is a way to get the footer content without constraint to know the structure of the footer' content?
Thanks
I have added bootstrap to my application and when i wrote
<div class="container-fluid">
<div class="row" ng-repeat="user in users " style="border: 1px solid black"
ng-click="goToUserDetails(user.Id)">
<div class="col-md-4 text-center">{{user.Email}}</div>
<div class="col-md-4 text-center">{{user.Name}}</div>
<div class="col-md-4 text-center">{{user.Password}}</div>
<div class="col-md-4 text-center">
<span class="glyphicon glyphicon-trash" ng-click="delete(user.Id);$event.stopPropagation();">
</span>
</div>
</div>
<button class="btn btn-danger" ng-click="gotoAddUser()">Add</button>
</div>
It works , but when I want to add a card
<div class="card">
<img class="card-img-top" data-src="..." alt="Card image cap">
<div class="card-block">
<h4 class="card-title">Card title</h4>
<p class="card-text">Some quick example text to build on the card title and make up the bulk of the card's content.</p>
Button
</div>
</div>
It doesn't recognize the bootstrap "card" classes (the btn works )
Can someone help me pls?
There is no default Card design in Bootstrap 3.3.6 or lower version.
So now we have only two option for design card.
The standard way is Upgrade your Bootstrap version like move 3.3.6 or lower to Bootstrap 4. Bootstrap 4 Card
--- OR ---
Write your own stylesheet for card design if you want your card design same as well as Bootstrap common design then you can pick that CSS from Bootstrap 4 Card. In this case you can just pick those design which was you actually need for your Card no any other extra CSS so it will not effect your other sections or modules.
I have a Modal on my View which contains a progress bar. The problem is, although I added the active class to the progress bar to animate, when I Inspect Element in Chrome, I can see that the .active class is not applied.
Here is my modal:
<div class="modal fade" id="pleaseWaitDialog" role="dialog" data-backdrop="static" data-keyboard="false">
<div class="modal-dialog modal-sm">
<div class="modal-content">
<div class="modal-header">
<h4 class="modal-title">Processing...</h4>
<p>This may take a while, depending on your connection.</p>
</div>
<div class="modal-body">
<div class="progress">
<div class="progress-bar progress-bar-striped active" role="progressbar"
aria-valuenow="100" aria-valuemin="0" aria-valuemax="100" style="width:100%">
Importing Patients
</div>
</div>
</div>
</div>
</div>
</div>
And here is a image of the modal when I Inspect Element.
Why is this happening?
Add your active class by yourself before the 'Show' model line as
$(".progress-bar").addClass('Active');
$("PleaseWaitDialog").model('show');
There is some piece of code that is removing this class.
Basically .active class you used is to animate the progress bar dynamically.
This may be occur if some of classes you used over write the .active class. You can test this problem by using this class in nested form or use it one by one.
Otherwise you can handle it by using java-script to handle it dynamically.
Try this :
<div class="progress progress-striped active">
<div class="progress-bar" style="width: 60%;">
<span class="sr-only">60% Complete</span>
</div>
</div>
I am trying to upload a file using selenium web driver in c#.
I am trying this:
WebDriver.FindElement(By.Name("upload")).SendKeys("C:\Users\test\Desktop\test.cs");
but this is not working.
This is working properly in selenium IDE but not in selenium webdriver.
Following is the HTML code of the page:
where I am trying to use following element:
<input class="js-attach-file" type="file" tabindex="-1" name="upload">
<!DOCTYPE html>
<html lang="en">
<head>
<body class="page-index firefox firefox-9 windows extra-large-window full-content window-up">
<div id="nocss">
<div id="surface" class="clearfix" style="height: 725px;">
<div class="window-overlay">
<div class="window" style="left: 375px; top: 50px; display: block;">
<div class="window-wrapper clearfix">
<div>
<div class="window-header-utils">
<div class="window-header clearfix">
<div class="window-main-col">
<div class="window-sidebar">
<div class="window-module card-label-list clearfix hide">
<div class="window-module clearfix">
<div class="window-module clearfix attachments">
<h3>Attachments</h3>
<ul class="attachment-list hide"></ul>
<p class="no-attachments empty">No attachments.</p>
<div class="uploader touch-hide">
<form class="realfile" enctype="multipart/form-data" method="post" action="/api/card/4f701c9daf1765861a15545c">
<input type="hidden" value="" name="token">
<input type="hidden" value="attachFile" name="method">
<input type="hidden" value="http" name="format">
<input class="js-attach-file" type="file" tabindex="-1" name="upload">
</form>
<a class="button-link highlight-icon fakefile js-fakefile">
</div>
<p class="error js-file-too-large" style="display:none; -moz-border-radius: 3px; -webkit-border-radius: 3px; font-weight: bold; margin: 8px 0 0; padding: 6px; background: #e3e3e3; ">File too large. 10mb limit.</p>
</div>
<div class="window-module other-actions clearfix">
<div class="window-module quiet-actions clearfix">
</div>
</div>
</div>
</div>
</div>
<div class="pop-over clearfix fancy-scrollbar" style="display: none;">
<script>
<script src="https://d2k1ftgv7pobq7.cloudfront.net/js/78dcaf5810779a263fe6939fc4895487/all.js">
</body>
</html>
You can find solution in below link.
You can solve it by using javascript
String script = "document.getElementById('fileName').value='" +"C:\\\\temp\\\\file.txt" + "';";
((IJavascriptExecutor)driver).executeScript(script);
Webdriver: File Upload
selenium is not able to identify or recognize the element whose attribute is type file.
Like example
<input type="file" id="id1" name="abc"></input>
so, to handle this situation we have to use third party tool like Point Position to compute x & Y coordinate of browse button.
then we can use either Low level mouse click handle in c# or we have to Use Autoit V3 tool to handle window popup.
You can find more in detail with full explanation and Practical example on my blog: http://avinashpandeblogsonseleniumautomation.blogspot.in/2015/06/upload-file-using-selenium-web-driver.html
If you are using Firefox browser instead of Send keys use type.
And If the browser is IE then u have to use tool like Autoit Or Selenium 2 contains a method attach_file or use this
sel.attach_file("css=input[type=file]", "http://url.com/file.txt")