What is the difference between id and tagname? [closed] - selenium

Closed. This question needs to be more focused. It is not currently accepting answers.
Want to improve this question? Update the question so it focuses on one problem only by editing this post.
Closed 7 years ago.
Improve this question
An Interviewer asked this question in selenium webdriver
Please let me know the answer of this question
Thanks
Srinu Marri

Tags
are HTML elements, like
<div>, <ul> , <p> , <h1> , etc
Id's
are ATTRIBUTES of tag names. For example:
a <div> tag can be given an id:
<div id='firstdiv' >
or a class name:
<div class="firstdiv">

ID
Identify uniquely HTML elements. Even if you add more than one ID inside a html page, the DOM object will render all elements even with the same ids, but if selected by JavaScript or selenium only will select the first one that is rendered.
E.g:
findElements(By.id("id"), Selenium will return an element with this id attribute that are present immediately after the page loads.
tagname
Works just like class elements. Can identify a element behavior or even a constant markup. The DOM object can handle with multiples elements and even scripts tags.
E.g: findElements(By.tagName("table"), Selenium will return an array of all the tables that are present immediately after the page loads.

Related

Why does the function work except #click? [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 1 year ago.
Improve this question
I using Vue3 and firestore
Here's my problem.
<textarea class="form-control v-model="form.comment" #keypress.enter="saveComment" required></textarea>
<button #click="saveComment">save</button>
#keypress.enter="saveComment" is works
but
#click="saveComment" did not work.
I don't know what's the difference between these two.
I used saveComment in the methods: {} in the script.
edited
When I ran the function through #keypress.enter, the page was not refreshed
But when I ran the function through #click, the page was refreshed and the function was not executed.
So I added a prevent.submit and it works well.
Considering the fact that you only shared little information on your question, I would be answering based on some assumptions.
The keypress event is an event emitted when a key that emits is character is pressed (this event is already deprecated according to MDN, so you might want to consider keyup/letdown event).
However, you should note that the #keypress.enter event according to Vuejs would only be emitted when an individual clicks on the enter Key.
#click event on the other hand would be emitted when a click event is observed on such element, in this case a button.

Need to get the value which is not available in DOM element [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
website
I want to get the value of highlighted field for the validation purpose. but the problem is it's not available in DOM element. Could anyone please guide me on this.
I am using selenium with C# for this automation
The value you want is accessible via JavaScript.
Devtools tells me the element is an input with id=amount:
You can then use the console to iterigate the element:
To run this in selenium you use a javascript executor.
You've not specified which language you're working with... so...
In Java:
JavascriptExecutor js = (JavascriptExecutor)driver;
var myValue = js.executeScript("return document.getElementById('amount').value");
in Python:
myValue = driver.execute_script("return document.getElementById('amount').value")
in c#:
var js = (IJavaScriptExecutor) driver;
var myValue = js.ExecuteScript("return document.getElementById('amount').value");
One last note - that element and slider is located within an iframe. You may need to switch frames in order to access it. Let me know if you need support with this.

In my DOM, my xpath identified two elements, one element is clickable and other is not. How to find which element is clickable using selenium [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 4 years ago.
Improve this question
My DOM is loading duplicate elements, i need to click on element which is clickable and another is not clickable. Wait statement doesn't help in this situation. which loop and conditions will be useful in selenium
Try this pseudocode example, get all of Your elements in list, and iterate them in loop, and check which one is able to click,
List<WebElement> listElements = driver.findElements(by some locator);
for (WebElement element : listElements){
if(element.isDisplayed() && element.isEnabled()){
WebDriverWait wait = new WebDriverWait(driver, 2);
WebElement element = wait.until(ExpectedConditions.elementToBeClickable());
element.click();
}
}
Hope this helps,

Vue.js 2 datepicker recommendation? [closed]

Closed. This question is opinion-based. It is not currently accepting answers.
Want to improve this question? Update the question so it can be answered with facts and citations by editing this post.
Closed 5 years ago.
Improve this question
I'm looking for recommendations for a Vue.js 2.0 date picker component. My requirements are fairly simple.
Should have option to pick a range - start date, end date.
Should be stylable.
Should be able to trigger a method when a date is selected.
I've been using https://github.com/charliekassel/vuejs-datepicker so far, which is good but doesn't have the range option (unless I've missed it). This one looks promising - https://github.com/mengxiong10/vue2-datepicker - but I don't immediately see how I can trigger a method when a date is selected.
There is a component family called Element, here is the DatePicker. You can import only the DatePicker if you want (Check the "On demand" part here).
It supports range selection (type="daterange").
There is also at least two ways to catch the selection event. It has a change event, and also with the picker-options prop you can pass an onPick callback.
I am not sure about the custom styling, as I can see there is a way to give a custom class for the dropdown with the popper-class prop but I am not sure how that works.

selenium Mosue Over not working if hover property is defined in CSS [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 2 years ago.
Improve this question
Selenium is not able to perform mouseOver if Hover property is defined in CSS
You can try yourself on this link using selenium ide
http://www.w3schools.com/cssref/tryit.asp?filename=trycss_sel_link_more2
Selenium mouse Over has no effect on this link
please visit this link
According to this question, this is one of those perennial problems Selenium and :hover css
They discuss a couple of solutions, but it looks like the problem is that as Javascript cannot trigger the :hover pseudo class, so Selenium can't either.