Not able to select a dropdown value using selenium webdriver(Java) - selenium-webdriver

I have no idea what is wrong in the simple code i have written to select a value from the dropdown. I have been watching other tutorials and code samples and i dont find any mistake in my code. Could someone please help me? I have tried running my code in Chrome as well as Mozilla(on two different OS) but still the issue exists.I am posting attachment of the html as well as selenium code.
Also, i am sure the problem is not because i have used wait because even if i comment that line or use it after loading the web page, the issue is there.
HTML
Selenium

Why don't you try clicking on the dropdown and then selecting the value.
tp.click();
and then
Select dropdown = new Select(tp);
dropdown.selectByValue("2");

new Select (driver.findElement(By.id("custtitle"))).selectByValue("2");
OR
new Select(driver.findElement(By.id("custtitle"))).selectByVisibleText("Mrs.");

Related

I am adding the code in weebly but it dosent show up

Issue with JSON LD CODE
To start with I am trying to use this code in weebly, buy using embed code option and then I click on the edit custom HTML and enter this code. However, after entering this nothing shows up as in the recipe is not shown on the page and a blank page is shown.
this code is picked on schema.org, for recipes.
Could anyone please help me out in what exactly went wrong. I really appreciate your assistance. FYI- I am new to this. I am trying to set up my own food website and and wanted to schema to for SEO improvement. Any other suggestions are welcome. Thanks in advance.
Please refer this link for the JSON-LD CODE. IT WILL BE AT THE END OF THE PAGE. https://schema.org/Recipe
When you add a JSON-LD block in the HTML, it doesn’t change anything visibly on the page. The script element is hidden by default in all browsers, and you typically want to keep it like that (users typically have no interest in your JSON-LD code).
To check if adding the JSON-LD worked correctly, open the page in a browser and check the source code of the page. You should see the script element with your JSON-LD.
You have to add the content (that should be visible to your users) regularly with HTML. The JSON-LD exists next to your content (duplicating the data like name, photo URL etc.), it doesn’t replace your content.

DHTMLXGantt with ReactJS setting work_time

I am trying to use DHTMLXGantt on my reactJs project, and I have gone through their tutorial when setting it up. Now I want to modify it to only consider the working hours by adding gantt.config.work_time = true which seems pretty straightforward.
However, when I add it, it still doesn't display only the work time (08hr - 17hr), rather shows hours from 00hr - 23hr on the gantt as below:
Would really appreciate if anyone has tried a similar thing and got it working. Thanks a lot.
Enabling worktime won't automatically change the time scale,
you'll need to hide columns using gantt.ignore_time function
gantt.ignore_time = function(date){
if(!gantt.isWorkTime(date))
return true;
};

Unable to select an option from Spinner using Appium 1.6

I am using Appium 1.6 to automate Android UI Tests.
In this image, I am unable to select any country (ex: Japan) from the spinner.
This is the code I am using:
driver.findElement(By.id("com.akkipet.android:id/country_spinner__add_information")).click();
driver.findElement(MobileBy.AndroidUIAutomator("new UiScrollable(new UiSelector()).scrollIntoView("+ "new UiSelector().text(\"India\"));")).click()
What am I doing wrong? After clicking on the spinner, though I'm not able to read the country values, I can read other fields like First Name, Last Name etc.
For now, I am using the tap functionality to tap at the specific coordinates to choose the required option. But this will make it device specific. Further, since the options list varies depending on the environment, I will have to give a different set of coordinates for each environment.
Code for Tap:
touchAction.tap (200, 850).perform();
Could anyone suggest a better workaround?
Try this one. It worked for me.
driver.findElement(By.id("com.akkipet.android:id/country_spinner__add_information")).click();
driver.findElement(By.name("India")).click();
By.Name has been deprecated. Try using findElementByAndroidUIAutomator.
Eg:
driver.findElementByAndroidUIAutomator("new UiSelector().text("India")").click();

ArcGIS Javascript Web Map Printout with Popup Shown

I have a working printing task that will simply use the ESRI Print Task to export to PDF like in this sample - https://developers.arcgis.com/javascript/jssamples/widget_print_webmap.html.
However, I was wondering if there is a way to include popups on the printout if the user has clicked on a feature and is displaying the popup at the time of printing. I have not seen anyone asking the same question unfortunately and would like to have this feature on my print task. Does anyone know if this is possible?
I have solved my problem by using a customTextElement and the following code to pick up when the infoWindow selection changes:
dojoOn(map.infoWindow, "selection-change", function(){
//build custom text here
}

Getting "Cannot call Method of "sendKeys" of undefined

I working on building some tests via the JMeter Webdriver plugin and am having issues with entering text into a textbox. Here is my code:
var textField = WDS.browser.findElement(pkg.By.id('element_id'))
textField.click()
textField.sendKeys('JMeter Test')
I get undefined for the sendKey method but both the findElement and .click() commands work without error...I have tried using .clear() as well with no luck. I have used the sendKeys command multiple times prior without issue. The field is in a modal, if that is relevant. Any suggestions? Thanks.
Okay..tried a bunch of complicated fixes but all I needed to do was add brackets...I thought you only needed to use brackets with variables but I guess not. So the code that worked was:
var textField = WDS.browser.findElement(pkg.By.id('element_id'))
textField.click()
textField.sendKeys(['JMeter Test'])
Thanks for your responses, Adam T.
I have tried all options, but nothing worked.
I changed the script Language from java to groovy. Then it worked.
var uname=WDS.browser.findElement(org.openqa.selenium.By.xpath("//input[#id='username']"));
uname.click();
uname.sendKeys("sampleUserName");

Resources