Basically my problem is that I can't remember how to do it, I remember being able to print out specific elements some how involving [3] or [ ],
I'm using driver.find_element_by_class_name('classname').click to click on say the 3rd item or for it to work it's way from top to bottom, I want to be able to loop this but what I have at the moment it just repeatedly clicks on the first item rather than go through the entire length of items that I have asked for?
It's 3:36am I'm tired in bed and not at my desk, If I need to provide more information I'll have to post in a few hours thanks in advance.
In order to use array notation, e.g. [1] or [2], you need a collection/array. In order to get a collection of elements using Selenium, you need to use .find_elements_* (note the plural, elementS). From there, you can get what you want, e.g.
driver.find_elements_by_class_name('classname')[1].click()
You can put that in a loop, replace the 1 with the index, e.g.
driver.find_elements_by_class_name('classname')[index].click()
and so on.
Related
Again trying to work on https://www.supremenewyork.com/shop/all/jackets. I want to be able to select products based on keywords I pass through but I want to figure out a way to do this better because Xpath brings me back the first black product that is black even if it does not match the first part of my find_element_by_xpath. I have tried nearly every other method of selecting things but this seems to be the best way to me as every other attribute is dynamic
driver.find_element_by_xpath("//*[text()[contains(.,'Raglan Court Jacket')]]") and driver.find_element_by_xpath("//*[text()[contains(.,'Black')]]").click()
Nice to see a fellow hypebeast here on StackOverflow, I've found a way to do this. By simply looping through elements and matching texts, using enumerate to get the next element and matching the text.
for index, element in enumerate(driver.find_elements_by_tag_name("a")):
if element.text == "Raglan Court Jacket" and driver.find_elements_by_tag_name("a")[index + 1].text == "Black":
element.click()
Use this xpath:
//*[text()='Raglan Court Jacket']/parent::div/following-sibling::div/child::*[text()='Black']
To select a black "Raglan Court Jacket", you can use :
driver.find_element_by_xpath("//*[contains(.,'Raglan Court Jacket')][following-sibling::p[contains(.,'Black')]]/a").click()
driver.find_element_by_xpath('//*[#id="PolarisTextField10"]').send_keys(img.value)
every order to add media change the number PolarisTextField[10]
I need to write a list like that
driver.find_element_by_xpath('//[#id="PolarisTextField["10,11,etc"]"]').send_keys(img.value)
sorry but i am beginner
Try the below solution where we are using find_elements_by_xpath to get all elements that starts with PolarisTextField id.
inputs = len(driver.find_elements_by_xpath("//*[starts-with(#id,'PolarisTextField')]"))
for inputIndex in range(inputs):
driver.find_elements_by_xpath("//*[starts-with(#id,'PolarisTextField')]")[inputIndex].send_keys("text goes here")
in version Revit2016
I have a problem, I want to collect the user has selected element, instead of letting the user re-select, I don't know if there is any way to solve it, just like I want to collect the information of the two columns selected on the way. Thank you
The ActiveDocument.Selection.GetElementIds() (or something close to that) - will be able to tell you the pre-selected elements when you start your command.
I'm trying to get every ID from a list that a user created. This particular user has made 5 lists ( https://foursquare.com/griekenlandnet ), but the API returns on 3 of them. But the list count in the response does say 5? I tried to add limit=100 to the API request, but it doesn't matter. I still only get 3 back.?
What is the trick to get all the list data back, and not only the first 3? I had the same problem with all the tips. Initially it only returned the first 30 responses, but that was fixed by adding the limit=100 to the API request. Only this trick doesn't seem to work for the lists?
I'm aware that all the tips are part of the general list, but I would like to be able to only show tips from list A, or List b etc. But for that to work I would need to list ID, and not all of them show up.
Any idea's how to get all 5 lists back, instead of just the first 3? This is the response I get from the API http://tijmensmit.com/4sq-list.html
Are you using the right endpoint? users/self/lists?group=created should give you all lists created by a user.
I am appending 20 images in form by using loop.when i am scrolling these images up and down i want selected image index so that i can view bigger size of selected image.
i used this form.append(image)
is there any method or way to get selected item index in form like in list there is getSelectedIndex.
plz help me and provide me gud solution ..
The APIs for javax.microedition.lcdui.Form don't provide a means to get the selected item index, most likely because it wasn't designed for that kind of use. For the use case as described in your question, the correct approach would be to use javax.microedition.lcdui.List. In addition to determining the selected item, List also provides other useful APIs such as setting a select screen command for the items in the list.