I am stuck at one point, I am trying to select a item in a dropdown. looks like this dropdown is somewhat made in "MuiInputBase-input"[ could be react JS- not sure]...see screenshot1
screenshot 1
I know selenium works with 'Select', where by value we could choose the dropdown item. This one seems bit challenging. Could someone please assist. i want to select let's say '25 Years' in the dropdown.
a very similar issue is here for someone else:
Select DropDown value using Python Selenium
I've already used selenium 'Select' but there doesn't seem to be any Options listed in HTML (searched the whole document)
Also, there is no iframe [searched and 0 iframe are involved]
I am expecting to select a choices in the drop down like in screenshot 2
screenshot 2
Related
I'm new to RSelenium working on a web-scraping project and need help in selecting a value from a drop down list. I've tried different ways including Xpath as the code below but failed all the times.
stateselect <- remDr$findElement(using = 'xpath', value = '//*[#id="state"]')
stateselect$clickElement()
Here is the url: https://www.cbd.gov.au/get-assessed/how/find-rated-building
I want to click to select a State (e.g., ACT) and click on Search button
Any advice or help would be useful and appreciated.
inspect page
Currently, I am writing a Facebook robot that will post the article automatically.
Every time you load the website, the post box's XPATH for group posts is slightly different.
In my case, below is what the XPATH to the post box looks like.
The ID name starts with mount_0_0_, but the end is slightly different. Additionally, the XPATH length is different. To handle the situation, I select the starts-with function. It appears, however, that the robot is unable to click on the post box.
Would it be possible for you to provide me with more assistance in this matter? Thank you for your assistance.
//*[#id="mount_0_0_Hk"]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div[2]/div/div/div[4]/div/div[2]/div/div/div[1]/div[1]/div/div/div/div[1]/div/div[1]/span
//*[#id="mount_0_0_oe"]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div[2]/div/div/div[4]/div/div[2]/div/div/div[1]/div[1]/div/div/div/div[1]/div
//*[#id="mount_0_0_JI"]/div/div[1]/div/div[3]/div/div/div/div[1]/div[1]/div[2]/div/div/div[4]/div/div[2]/div/div/div[1]/div[1]/div/div/div/div[1]/div/div[1]/span
Here is my code
button = driver.find_element(by=By.XPATH, value='//*[starts-with(#id, "mount_0_0")]')
Admittedly, I know just enough about Angular to be dangerous. However, I'm fairly certain I've followed the instructions for the plugin concisely.
The issue is: whenever I select any of the options from one of my select fields using the chosen plugin (City, Nationality, Hotel, Room Type...) the result never gets populated, and the results from all the other select fields disappear. I'm fairly certain this is user error on my part - any clarification or help is much appreciated.
You can see an example here: http://casamarelanoivas.com.br/sst/test/
Thanks.
Kyle
You are binding the selected value in your list to the same model variable you are using to generate the dropdown list. So whenever you select a value from the drop down list, you are wiping out the list values.
Here is what you have:
<select ng-model="model.cities" ng-options="city.name for city in model.cities">
This is the pattern you want to use instead.
<select ng-model="selectedCity" ng-options="city.name for city in model.cities">
In your controller you can then get the selected value from $scope.selectedCity
Open one web page say gmail.
Want to count that how many text field or buttons or checkbox or hyperlinks or other html elements are present.
The solution is very simple . This can be done using simple XPath.
Find the type of element count you need.
eg for text fields: xpath can be : input[type='text']
for radio buttons: xpath can be : //input[#type='radio']
for check box buttons: xpath can be : //input[#type='checkbox']
so find all the elements in the page by using simple command using the above xpath:
webdriver.findElements(By.xpath("REQUIRED_XPATH")).size();
will give you the number of elements in the particular web page.
I am using c#. If you use c# as well the followings is the something you want to use. And you decide what tags you need inside the selector. I am using all the tags so far.
ReadOnlyCollection<IWebElement> webElements = Driver.FindElements(By.CssSelector("input, select, textarea, a, button"))//and keep adding
//then do a simple count. The trick here is the selector and you need to make sure you are adding all the tag names are being used in your application
webElements.Count();
If you want to count all elements of a page, you can simply use * for that as shown below.
List<WebElement> items = driver.findElements(By.cssSelector("*"));
System.out.println(items);
Here is how to know instantly how many items in the list on the website, for example, languages in the wiki, using right-click "Inspect element".
Screenshot
I just wanted to see if anyone has had experience with the issue I having. I am currently populating a select element from a restful web service using the ng-options feature and assigning it to my model with ng-model. I have also applied a filter to this select that changes the list based on the value from another select element. Everything works as intended from the display side. If I change the master select element and it filters the second select to not include the currently selected item, the display shows correctly and displays 'please select'. So this looks great and works as I intended but when this scenario happens the underlying model isn't updated and still has the invalid option stored in it. If I pass the model back to the server for further processing, I am getting values that might not be valid.
Does anyone have any ideas on how to have selected that filter one another also update the underlying model ?
I appreciate any ideas.