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()
Related
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.
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")
I'm using autocomplete on a field in Azure Search... it works great, however I want the autocomplete results to return the next "x" number of words (like in the following screenshot https://learn.microsoft.com/en-us/azure/search/index-add-suggesters)
I've tried all three Autocomplete types "oneTerm", "twoTerms" and "oneTermWithContext" however none of those give me the expected results.
I expect to type "tom clan" and autocomplete should return "tom clancys rainbow six siege"
Excellent point about the documentation showing several words in the example and the autocomplete API only supporting up to two terms ahead. I think we should update the example to better reflect the actual behavior of the API.
If you are interested, please create a feedback item for the API enhancement you suggested so it can collect some votes: https://feedback.azure.com/forums/263029-azure-search
Thanks!
Mike Carter
Azure Search product team
Currently, the site search will search all of the skus of the items marked as being visible in search. This is all well and good.
The problem arises when the customer knows a sku of the individual child item. So, let's say a product comes in both a 20 foot and 25 foot variation. We would put those into a configurable product and have a single product page where a customer could then choose which of those two lengths.
What happens is, a customer invariably knows that the sku of the 20 ft variation is RDB-20, while the other is RDB-25. A search for RDB-25 then, comes back with no results since the simple product is not visible in search - it doesn't realize there is a match.
How do I get the search to search an item with visibility "Not Visible Individually", when it's parent is visible in search?
The desired effect is that, if a child SKU is searched for, the parent should show up in the results.
There really is no good way of doing it without extending the default search, but at that point you might as well look for other options.
Here's a workaround that might be doable depending on how you manage your products and it worked for me until I moved on from the default search.
Rather than altering the search, try adding an attribute to all products and make it hidden concatenating all the skus into this field. The search should find the text attribute and show the configurable.
Its a bit of a workaround but works for me.
This is untested, but I did a bit of perusing in our attributes and I think I found something that might help.
Currently since our child products don't show up in our search, we have the parent populate with the children product's attributes.
However, things like brand, taxable amount, description, populate for every child product while our SKU does not.
The only difference I can see between the two attributes is under manage attributes -> click on attribute -> and then under properties go to frontend properties and select
Use In Search Results Layered Navigation: YES
Used in Product Listing: YES
Use In Layered Navigation: Filterable (with results)
I'm not sure which of these do what, but in the population of the fulltext search data table, somewhere it is being told to populate for the children and I believe that the admin panel is where.
I hope this helps!
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.