When attempting to write in the text field using selenium, I encountered an error stating "unexpected identifier". Any assistance with this issue would be appreciated. See image for more details
When attempting to write in the text field using selenium, I encountered an error stating "unexpected identifier". Any assistance with this issue would be appreciated. See image for more details
If you are unsure about the selector being used, you can try the following code for the input tag visible in your snapshot. It's just a blind attempt:
WebDriverWait wait = new WebDriverWait(driver, 30);
wait.until(ExpectedConditions.visibilityOfElementLocated(By.name("firstname"))).sendKeys("whatever");
In general, you can also use this code:
driver.findElement(By.name("firstname")).sendKeys("Whatever");
You might find assistance in this thread - Selenium Webdriver: Entering text into text field
Here is the complete working code. For demonstration purposes, only firstname and secondname have been filled. Feel free to like the answer if it helps.
import org.openqa.selenium.By;
import org.openqa.selenium.WebDriver;
import org.openqa.selenium.WebElement;
import org.openqa.selenium.chrome.ChromeDriver;
import org.openqa.selenium.support.ui.ExpectedConditions;
import org.openqa.selenium.support.ui.WebDriverWait;
import java.util.concurrent.TimeUnit;
public class Testing {
public static void main(String[] args) {
WebDriver driver = new ChromeDriver();
WebDriverWait wait = new WebDriverWait(driver, 30);
driver.manage().timeouts().implicitlyWait(10, TimeUnit.SECONDS);
driver.manage().window().maximize();
String myurl = "https://www.phptravels.net/register";
driver.get(myurl);
WebElement FirstName = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@name=\"firstname\"]"));
FirstName.sendKeys("Dina");
WebElement LastName = wait.until(ExpectedConditions.visibilityOfElementLocated(By.xpath("//input[@name=\"lastname\"]"));
LastName.sendKeys("Hayden");
System.out.println("Successfully Enter Value in the textbox.");
}
}
Is it possible to make the required value dependent on a function? Something similar to this? I need to achieve this in order to dynamically change the required attribute for form inputs... HTML: Name: <input type="text" ng-model="user.name" ng-r ...
I am using Zend Framework to create a form element that utilizes Zend_Dojo_Form_Element_ComboBox. By setting dojox.data.QueryReadStore as the store type, I am able to generate a list of selectable values in my HTML input field. This allows me to either cho ...
When using LabJS to asynchronously load scripts with a chain of dependencies, if one of the scripts breaks (due to download failure or connection timeout), it seems that the remaining scripts in the chain will not be executed. Is there a way to define a ...
As someone new to Node, I need some help with a server-client web application I'm creating for a board game using Raphael for graphics. The issue I'm facing is that while the server successfully sends the HTML file in response to requests, the b ...
My React board component consists of an array of divs that I want to arrange in a grid-like map. The issue is, when the div wraps to a new line, there is significant space between each row. I aim to have the divs close together with no gaps. GameMap state ...
I am trying to import a js file in typescript and access objects and functions within the file. I have added the js file in index.html, but it is not working as expected. I tried using "import '[js file path]'" but it did not work. import { Comp ...
I've been working on a web scraper using RSelenium, but have found that certain tasks are better suited for Python. To streamline this process, I've created a .Rmd file with code snippets in both R and Python. The RSelenium side of the project i ...
I am working on a directive that injects dynamic templates during ng-repeat. While I can successfully add items to the list, they do not appear in the view for some reason. It seems like I am missing a crucial piece to make it work correctly. You can find ...
I am trying to implement a feature similar to the one found at http://jsfiddle.net/theimaginative/gA63t/ within a wordpress post. I have attempted to create a shortcode for inserting this into a post, but I am encountering difficulties. While I have been s ...
Issue: The mouse hover action is not highlighting the element when using selenium's mousehover() method. Attempted Solutions: We have tried implementing the three solutions provided in the link, but none of them have been successful in achieving the ...
I am currently using Selenium and Firefox geckodriver to capture screenshots on Windows 10. delay = 5 browser = webdriver.Firefox(executable_path="C:\\Users\\A0048436\\Downloads\\geckodriver.exe") browser.set_window ...
I've been on the hunt for a solid working example of using AJAX with Codeigniter, but most resources I've found are outdated. As an AJAX beginner, I'm struggling to find up-to-date tutorials. What I'm aiming for is an input form on a w ...
There is a div element: <div id="ddDistr" class="searchBoxSortDistrict" tabindex="1"> <ul id="ddd"> </ul> </div> I have inserted HTML from json into it: $("#ddd").html(" "), $.each(dis, function( index, value) { $("#dd ...
I am attempting to launch a React Native project using Expo from this site npm install expo -g expo init AwesomeProject npm start However, when running npm start, I encounter the following error: npm ERR! code SELF_SIGNED_CERT_IN_CHAIN npm ERR! er ...
One of my goals is to alter the colors of my cell within a table by using the following code in my td data-ng-class="{selected.id == price.id && !price.isMinPrice ? 'selected' : '', selected.id == price.id && price.isMi ...
Currently, I am working on a project that involves Node.js with express.js and redis.io as the database. I have implemented a get resource with query parameters to retrieve the IDs of libraries containing a specific book. However, I am struggling to unders ...
While exploring the website , I noticed that clicking on Availability Zones opens a small window with text on the right side of the page. Is it possible to achieve a similar feature on a leaflet map without using JavaScript? This functionality would be tri ...
After observing that the response of an ajax call using jQuery is never empty, I have come across the following code snippet: $.ajax({ type: "get", data: { data }, url: "phpFile", datatype: 'text' }).done(functio ...
When working on a method similar to System.arraycopy in the Java library, I encountered an issue with using an object as an array. The problem arose when arr2 required an array, but java.lang.Object was found instead. Here is the code snippet: public st ...
I have an object with the following key-value pairs: { 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/nameidentifier': '918312asdasc812', 'http://schemas.xmlsoap.org/ws/2005/05/identity/claims/name': 'Login1&a ...