On my Webpage I have three Dropdown Controls. When First Option is selected in the First Combo, the Second Combo Control Gets Populated and similarly on selecting an Option in the Second Combo populates the Third Combo Control.
Each Combo Control has a above it. Using Selenium in VB.net, I am able to find the First Combo Control and iterate through each Option Available. The Challenge I am facing is that, the label on Second and third Combo gets its text from the the Selected Option of the First and Second Combos, respectively. However, the XPath changes randomly with each option selected due to which the FindElement(By.Xpath) fails.
The example Combos are available this Link Set of Three Combos
I tried using the following VB.net Code
Dim CWEstring = "./following-sibling::select"
GE = New SelectElement(driver.FindElement(By.XPath(CWEstring)))
and
Dim GEString = "./following-sibling::select"
GE = New SelectElement(driver.FindElement(By.XPath(GEString )))
I did my research for few days but couldn't get the answer, so posting here for help.
Use the following xpath to identify the element.
1st dropdwon:
//select[#id='edit-field-select-zone2-value']
2nd Dropdown:
//select[#id='edit-field-cce-army-no-1dinjan-cwe-tid']
3rd dropdown:
//select[#id='edit-field-pm-khonsa-tid']
Please note you have to provide some wait after selecting each dropdown item to appear next dropdown on the webpage.
I Downloaded the webpage Source and Edited the code to bear minimum HTML content so that all three Combo Controls are visible and save the html content as a .htm file on local disk.
Using chrome I opened the .htm file. Then Using MS-Excel From Web under Data tab Scraped the data from the local .htm file.
Now I had all values under one Column Header name. I converted all values under column name into an array.
Using VB.net and Selenium technology, I iterated through each combo control and saved the data to a New Excel File.
More Challenges came to fore. Therefore, I used Try...Catch method to trap the error and Continue the Iterations (Loops).
And now I have all the values the way I wanted them.
Related
I have a button that brings up the find popup using the code:
SendKeys "^f", True
Currently when it finds the correct record the combo boxes do not refresh. The are dependent on one another like a tree (what is displayed in the second box depends on what you select in the first) so without a refresh the correct information is not displayed and I qould like this to be automatic with the search. I have tried:
cb1.requery
after the find popup is brought up and this did not work so I am not sure where to go from here...
I have a MS Access form that is bound to a query in the database. I added a textbox and added a row source to a Hyperlink datafield in the query. When I open the form, it won't allow me to drop a file into the textbox.
Here's the deal. When I follow this EXACT same process on a new form, it works perfectly. That is, I open a blank form and I bind the form to some new query, let's say qryNewIdeas. Then on the blank form i add a textbox, let's say Text0. Then, when I select Text0, I go to the data tab - row source and choose the dropdown arrow to select the hyperlink field, lets say NewIdeasAddress. I click SAVE and open the form. It works PERFECTLY.
BUT, when I repeat this on an existing form (the one where I need the thing to actually work), it does nothing. It adds and changes the textbox to a hyperlink box (I note this because of the blue underlined word that appears in the box). But it won't allow me to drop files to this location.
I tried commenting out ALL of my VBA code to try to make sure that something wasn't hindering it (say in an OnLoad event) AND I've checked all of the form and control box properties and they seem to be the same in both the existing form and the test form.
I can't determine why it works on one form and not the other; Solution needed.
If you have access to "the data tab - row source ..", you are in design view.
When you later open the form, you are in form view, a completely different animal which specifically prohibits design changes.
It sounds like you will have to rethink your concept.
I have an Access 2010 form with a subform that is displayed in datasheet view. The users want to be able to select and copy the rows from the subform and when they paste into Excel they want the table header to be the value from the main form. Currently it just uses the name of the subform. Is there a way to set this to something else?
Here is what currently shows up in Excel after I paste the copied grid. What I want to have displayed instead of fsubFYTBSummary is a field from the parent record of the form that invoked the subfrom. Is there a way to set this?
There is no way. The copied name is the name of the source object, not the subform control (that would be changeable).
Actually I'm surprised you see this name in Excel. I only see it when pasting a grid to Word or an Email, where the HTML clipboard format is used. The name is the table caption.
You can use http://freeclipboardviewer.com/ (portable) to see the various formats of clipboard contents.
I am using Visual Studio 2010 and coding in VB.
I have a form with a WebBrowser object in it.
I have control over the HTML on the pages.
I need the user to be able to select a portion of text in the WebBrowser object and save it.
In the save process, I need to capture the selected text, the ID of the HTML element that contains the selected text, and the URL. Then when the user goes back to that page, the program can place an icon on the page right next to that object.
I do not have any code to accomplish this yet, I do not have much experience with the WebBrowser object so I didn't even know where to start. I can however give the names of my form objects and inform you that all of the html elements have an ID.
Form : frmContent
WebBrowser : wbContent
I am guessing that I could even record coordinates of the selected portion of text instead of the html element. Either way, the final outcome needs to save a list of these locations paired with their url so that for every saved "bookmark", there will be an icon placed on the page of that url in the saved location of the page.
Found that this works rather well for me.
GetElementFromPoint(e.ClientMousePosition)
I was able to set this to a variable and then able to get the attributes from the element.
Dim bookmarkElement = wbContent.Document.GetElementFromPoint(e.ClientMousePosition)
Dim elementID = bookmarkElement.GetAttribute("id").ToString()
Problem solved.
I've created a hyperlink control on a form page in an Access 2013 App hosted in SharePoint 2013, and want the text to display the same text ("Print Timesheet") while the actual link itself varies based on the value of a field in the record. This is so that I can link to a separate application using a query string with the individual record ID, which gets the data directly from the azure database and formats it in order to be printed out.
I've tried a macro expression to create the link address that runs "on current" and sets the value of the hyperlink, and also tried a computed column in the table to create the link which I pass to the hyperlink control value. I've set the "Default Display Text" on the hyperlink control to "Print Timesheet" in both cases.
The problem I have is that whichever way I try it, changing the value on the fly like this overrides the default display text of the hyperlink so that it displays the address itself rather than the text I want to display.
Is there any way round this?
Thanks,
Duncan
I am not sure if you got your answers. I was randomly looking on internet and found your query.
I thought the thread Troubles with Hyperlink control in Access Web App forms may have your answer.
LILizEidsness replied on August 21, 2014See post history
.....
If you have to build a url field dynamically, the basic syntax is
displaytext#url#
so, in my dynamic field....
=Concat("Click here#/relative/path/on/my/sharepointsite/allitems.aspx&ID=",[ID],"#")
....
You could use a label on the form to represent the link. Have the Label.Caption property set to "Print Timesheet" and use the On Current event to set the Label.HyperlinkAddress property to whatever the address from the recordsource is.