Selecting one value from the dropdown - excel

I am trying to select a value from dropdown list but my script keep on failing. the value that i am selecting is from Excel document with the 'Manager' as the value.
here is my xparth
And Here is my console
i tried different solution but with no luck. the below code is the one i am trying that produced the error.
Select select = new Select(driver.findElement(By.xpath("//*[#id='main']/div/div[2]/form/div[2]/div[7]/div/div[1]/div[1]")));
select.deselectAll();
select.selectByVisibleText(AGR);
Will appreciate your help.

The code should be select.selectByVisisbleText("Manager"). Partial Text is not accepted.Complete text should be entered.

finally i found solution to my problem. all i had to do is to find the xPath and send keys from the excel doc and click enter on the keyboard. this means i can change the name that is on the dropdown on the excel document, rather than hard code it on code.
WebElement webElement = driver.findElement(By.xpath("//*[#id='main']/div/div[2]/form/div[2]/div[7]/div/div[1]/div[1]/input"));//You can use xpath, ID or name whatever you like
driver.findElement(By.xpath("//*[#id='main']/div/div[2]/form/div[2]/div[7]/div/div[1]/div[1]/input")).sendKeys(AGR);
webElement.sendKeys(Keys.ENTER);
hope my solution can help any one experiencing the same issue.

Related

Conditional text in a text box depending on drop down box values

I'm having all sorts of fun trying to get a text box to display a message depending on the contents of two dropdown selection boxes.
I have a small list of messages I would like displayed depending on what the dropdown box contents are eg.If dropdown box 1 (contained in cell N7) had ON selected AND dropdown box 2 (in cell N8) was also ON then a message contained in cell AA25 would populate the message box. Similarly, if N7=yes and N8=no then the text contents of AA26 would show up instead.
If none of the conditions are true then I need a blank box (necessary) or even a random text from a list of inspirational quotes!! (Not entirely necessary but it would be fun!!)
I know how to link a message box to a cell content but each time I try to use boolean it tells me I'm missing something! I tried some of the examples listed on other folk's questions to no avail.
Here's my somewhat simple code when I try to use boolean..
=IF $N$7="ON" AND $N$8="ON" THEN $AA$25 Very basic as you can see but I like simple!!
I get a range reference or defined name error.. as you can tell, I'm new to this but learning slowly. Any help would be appreciated. Eventually there will be several IF/AND/OR statements in the conditions with different text for each result.
Thank you.

VBA Checkbox pop-up that sets filter?

I'm curious if it's possible in VBA excel to have a popup checkbox that will filter results. As an example a popup box (similar to an input box) comes up with several choices you can "check" that will then cause it to filter a specific column with just the items you checked.
Also I should mention this is something I plan to use in connection with a macro I'm running to help automate the filtering process. So I cannot just setup a checkbox on the spreadsheet itself. I'd need it to be an actual pop-up.
I'm not very versed with check boxes or their use in VBA so I'm not sure if this is possible or not. Any help or direction would be greatly appreciated.
Thanks!!
-Deke

Populate Textboxes by Clicking a Table in MVC

Populate Textboxes by Clicking a Table in MVC. The Javascript code which I am using doesn't change the text boxes values when I select another row on the table.
Does anyone have an idea please help?
I have the Answer to My own question, so any one who needs it. just say the word and I'll type the problem is am using a phone right now

Changing option value in dropdown item using excel vba

I am new learner to programming and new to excel-VBA as well and learning scraping through it. I am trying to programmatically change the color on a website having below html
<div><select id="Color" name="Color" data-dojo- type="dijit.form.FilteringSelect"><option value="ORANGE">Orange</option><option value="GREEN" selected="selected">Green</option><option value="YELLOW">Yellow</option></select></div>
IE1.document.getElementByID("Color").Value = "Orange"
IE1.document.getElementByID("Color").Focus
IE1.document.getElementByID("Color").Click
After doing this I can see the "Orange" being written on the dropdown on webpage but when I submit the form on website then it considers the default selected "Green" value and not the changed value which is "Orange". Also tried focus and click but still no luck.
Could you please help me out here? I tried searching for any existing VBA solution but could not find any. I think dijit.form.FilteringSelect is what it is making it unique.
You will have to change the value using dijit tools.
The first command grabs the widget from dojo's widget registry.
They second command changes it.
var fs = dijit.registry.byId("Color");
fs.set("value","Orange");

form view in excel for a record

I have a sheet in excel that is basically like a database (yes it has to be in excel unfortunately) and I want to design a simple form to display the records (the different column values in the rows). Usually MS is good with making widgets to do this but I cant seem to figure out how to write it in VBA (easily)
Basically I have a list of Names and ID#'s then some other columns that need to be filled in (address, order # etc) but I'd like the user to do this via a form rather than typing in excel. I created a small form in VBA, but now I cant link the columns to the textboxes in the form.
Anyone know of any code I can plug and play to do this.
Specifically I am using a ComboBox (for the list of names) and then a for loop searching through it to find the selection and updating data. But its a real pain.
plus I cant figure out how to put in a 'Next' button, which is really annoying me. Does anyone know how to change the comboBox value to the next row, if it is linked via RowSource
Have you considered the Form feature? You can find under the commands you can add to your QuickAccess toolbar.
Check this helpful tutorial for additional details.

Resources