Selenium WebDriver 2.53.1 NoSuchElementException [closed] - c#

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 6 years ago.
Improve this question
I am using Selenium WebDriver 2.53.1 for Visual Studio 2015. I have a webelement I have called probably close to 1000 times and now I am getting a no element exception.
I have troubeshooted this issue using the following:
Checked given xpath error in stack trace and matched it against the html in firebug
Hovered over html and confirmed the same html highlights the button in the UI
Added a wait (Using C#) wait.Until(ExpectedConditions.ElementToBeClickable(btnNewCustomer));
Selected elements around it to make sure there wasn't a bigger issue
I have defined the WebElement at the point in time its called
I have tried both
.Click()
.SendKeys(Keys.Enter)
I have exhausted all my options, am i Missing any other ideas?

Guess, but an educated one. I think, when you tried to add a wait, you actually issued FindElement before the wait which triggered NoSuchElementException. Try to do it this way:
var wait = new WebDriverWait(driver, TimeSpan.FromMinutes(1));
var btnNewCustomer = wait.Until(ExpectedConditions.ElementToBeClickable(By.Id("id_of_your_element")));
btnNewCustomer.click();

Related

I have trouble sending text to another program, please help me [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 11 months ago.
This post was edited and submitted for review 11 months ago and failed to reopen the post:
Needs details or clarity Add details and clarify the problem by editing this post.
Improve this question
I am sending some keys and text to a website in Firefox with this code:
IntPtr calcWindow = FindWindow(null, "website - Mozilla Firefox");
if (SetForegroundWindow(calcWindow))
{
SendKeys.SendWait("{TAB}");
SendKeys.SendWait("{ENTER}");
SendKeys.SendWait("hello world");
}
Now the problem is that it is sent too many times. For example, the text "hello word" that he sends in the text box is sent about 60, 70 times. I want each key or text to be sent only once. Thank you for your help.
I made a correction to the code but I did not get any results.
After guiding the esteemed users, I realized that the problem is in the ring counter numbers, and after changing the condition and the for loop counter, I reached the appropriate result and the problem was solved.
The counter part in the for loop can increase or decrease the value of the variable. The for loop executes a block of code repeatedly.

Unknown message while debugging in Visual Studio 2012 [duplicate]

This question already has answers here:
Your step-into request resulted in an automatic step-over of a property or operator
(9 answers)
Closed 8 years ago.
Today while i was debugging my code step by step i encountered one message while debugging my ASP.net web api.
I had never encountered any such message. What is this message and why it came, what is the main purpose of it. Can anybody explain.
Visual Studio is asking that its going to skip some code and debug your program. And this message is to ask that do you need to be informed whenever this happens.
If you want to be informed in future, you can select "Yes" otherwise select "No"
You can simply ignore this and continue.

HttpContext.Current is null only when debugging [closed]

Closed. This question needs debugging details. It is not currently accepting answers.
Edit the question to include desired behavior, a specific problem or error, and the shortest code necessary to reproduce the problem. This will help others answer the question.
Closed 8 years ago.
Improve this question
I've recently started working on an established MVC application using VS2013.
For some reason, HttpContext.Current is null only when running in debug mode - If I remove breakpoints it seems to work, but I don't understand why this should happen running locally.
This isnt just on Chrome - so far, it also happens when debugging through IE11.
If it helps, the solution is using IIS Express as dev web server.
public UserSessionData GetSession()
{
HttpSessionStateBase httpSession = new HttpSessionStateWrapper(HttpContext.Current.Session);
}
Do not keep the Debugger in this line -- > HttpSessionStateBase httpSession = new HttpSessionStateWrapper(HttpContext.Current.Session);
After executing this line, then only the value will be assigned to this variable httpSession.
So, Keep the Debugger in this line --> }. Then check the httpSession in QuickWatch or Mouse Hover.
The value should be there. No its not a Generic Issue. Its Human Error / Mistake.

reading div after javascript load [closed]

Closed. This question needs details or clarity. It is not currently accepting answers.
Want to improve this question? Add details and clarify the problem by editing this post.
Closed 8 years ago.
Improve this question
I'm having problems parsing information from a forum.
Heres some examples:
Easy
Hard
It would be really easy to get the information as they are displayed in the div where id = "poe-popup-container".
The problem is that that div is only populated when the browser allows you to see the information. That can be easily reproduced by making your browser height really small and looking in the HTML code for the . However, the div will be empty, but as soon you scroll down to see the item it will change.
I'm trying to read the nodes inside the with htmlagillitypack. The problem is that, as i explained, it only has information when the browser says that you need that information.
So, when you try to download the html, the div is empty.
I've tried to download the page with the web browser too, but the same thing happens.
I'm trying to use the following code:
string page = System.Text.Encoding.UTF8.GetString(Webclient.DownloadData("http://www.pathofexile.com/forum/view-thread/966384"));
HtmlAgilityPack.HtmlDocument doc = new HtmlAgilityPack.HtmlDocument();
doc.LoadHtml(page);
HtmlNode node = doc.DocumentNode.SelectSingleNode("//div[#id='poe-popup-container']");
MessageBox.Show(node.InnerHtml);
You're trying to do impossible. Javascript is executed in browser. HtmlAgilityPack is library just for parsing static html - it can't execute javascript.
So why don't you look into browser automation instead ? Try for example http://watin.org/

Programatically Shows a Pop Yes No Pop up inside a code [closed]

Closed. This question does not meet Stack Overflow guidelines. It is not currently accepting answers.
Questions asking for code must demonstrate a minimal understanding of the problem being solved. Include attempted solutions, why they didn't work, and the expected results. See also: Stack Overflow question checklist
Closed 9 years ago.
Improve this question
Good Day Every one,
Can you help me produce a code to produce pop up window like return confirm? the thing is it should be inside a method not after a click.
if (a == "1")
{
//Page.ClientScript.RegisterStartupScript(this.GetType(), "messagebox", "<script>$(document).ready( function() { csscody.confirm('<br/><h1> Confirmation</h1><br/> We have currently existing Details for that Upload Proceed?<br/>',{onComplete: function(e){if(e){process();__doPostBack('ctl00$ContentPlaceHolder1$btnCommitSaving','');}}});return false;});</script>", false);
//ClientScript.RegisterStartupScript(typeof(string), "messagebox", "<script language='javascript'>alert('Continue Uploading?.');</script>");
// here a pop up message should appear if he press yes he will do the procedure if no the program will cancel the procedure
// the other one is just an alert with OK button not having Yes or no
}
i tried the code with // but its not working it just passes by it in debug mode.
im sorry but i have a very minimal understanding about javascripts. so please help me any reading materials for my future reference would be ideal but a code with explanation would be better Thank you so much!
**Edit
Honestly Speaking i really do not know why it is not working in debug mode it just passes in that statement without any pop up box that appears, im really sorry if i do not know about javascripts that's why im asking help to enlighten me, also to find a way around about this problem.
ClientScript.RegisterStartupScript
you should only do it on if you want to add the script on page first load and not after you postback and you can use javascript confirm
Page.ClientScript.RegisterStartupScript(this.GetType(),
"ButtonClickScript", "confirm('Please select date within the same month and year')", true);

Categories