Answered by:
Finding a string on a javascript based website and innitiate click

Question
-
I'm trying to find a picture on a javascript based website and click on it. Below you can see the code I have tried, but always getting error, the website can only be opened via Internet Explorer, no other browser will display it properly. What should I change or how should I approach that clicking on the button would open the website, find the picture and initiate a click on it?
private void Button3_Click_1(object sender, EventArgs e)
{
var options = new PhantomJSOptions();
options.AddAdditionalCapability("IsJavaScriptEnabled", true);
//System.setProperty("webdriver.ie.driver");
IWebDriver driver = new InternetExplorerDriver();
//IWebDriver driver = new PhantomJSDriver("phantomjs Folder Path", options);
//IWebDriver driver = ($"c:\\Users\\kocsism\\Documents\\phantomjs-2.1.1-windows\\phantomjs-2.1.1-windows\\bin\\", options);
driver.Navigate().GoToUrl("url");
try
{
string pagesource = driver.PageSource;
//driver.FindElement(By.Id("New Incident..."));
//driver.FindElement(By.LinkText("New Incident..."));
driver.FindElement(By.Name("new_incident_16.png"));
Console.Write("your element has been found");
}
catch (Exception some_exception)
{
Console.WriteLine(some_exception.Message);
}
Console.Read();
}- Moved by Wendy ZangMicrosoft contingent staff Thursday, April 18, 2019 8:22 AM
Tuesday, April 16, 2019 3:00 PM
Answers
-
Hi
Thank you for posting here.
Since this thread is related to PhantomJSOptions, it is a third-party product, you could post in the following forum.
https://www.bryntum.com/forum/viewtopic.php?f=21&t=6243
Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.
Best regards,
Jack
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Marked as answer by kocsism Wednesday, April 24, 2019 7:39 PM
Wednesday, April 17, 2019 2:19 AM
All replies
-
Hello,
Things that need clarity, what is the exact error, what is PhantomJSOptions. More details are best so feel free to expand on the details.
Please remember to mark the replies as answers if they help and unmarked them if they provide no help, this will help others who are looking for solutions to the same or similar problem. Contact via my Twitter (Karen Payne) or Facebook (Karen Payne) via my MSDN profile but will not answer coding question on either.
NuGet BaseConnectionLibrary for database connections.
Tuesday, April 16, 2019 3:19 PM -
Hi
Thank you for posting here.
Since this thread is related to PhantomJSOptions, it is a third-party product, you could post in the following forum.
https://www.bryntum.com/forum/viewtopic.php?f=21&t=6243
Note: This response contains a reference to a third party World Wide Web site. Microsoft is providing this information as a convenience to you. Microsoft does not control these sites and has not tested any software or information found on these sites; Therefore, Microsoft cannot make any representations regarding the quality, safety, or suitability of any software or information found there. There are inherent dangers in the use of any software found on the Internet, and Microsoft cautions you to make sure that you completely understand the risk before retrieving any software from the Internet.
The Visual C# forum discusses and asks questions about the C# programming language, IDE, libraries, samples, and tools.
Best regards,
Jack
MSDN Community Support
Please remember to click "Mark as Answer" the responses that resolved your issue, and to click "Unmark as Answer" if not. This can be beneficial to other community members reading this thread. If you have any compliments or complaints to MSDN Support, feel free to contact MSDNFSF@microsoft.com.- Marked as answer by kocsism Wednesday, April 24, 2019 7:39 PM
Wednesday, April 17, 2019 2:19 AM