Jobserve clicking on Aspire media link | Selenium C# Forum
S
shobha bandaru Posted on 17/12/2018
I have this code and its not working. 


using System;
using System.Collections.Generic;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using OpenQA.Selenium;
using OpenQA.Selenium.Chrome;
using OpenQA.Selenium.IE;
using OpenQA.Selenium.Support.UI;

namespace ConsoleApp1
{
class jobserve
{
public static void Main(string[] args)
{

IWebDriver driver = null;
driver = new InternetExplorerDriver(@"C:\Users\sbandaru\Desktop\example\Drivers");
driver.Navigate().GoToUrl("https://www.jobserve.com/us/en/Job-Search/");

Console.Write("title is:" + driver.Title);

WebDriverWait wait = new WebDriverWait(driver, TimeSpan.FromSeconds(10));

wait.Until(ExpectedConditions.ElementIsVisible(By.XPath("//*[@id='mainfooter']/div[4]/a")));

//wait.Until(ExpectedConditions.ElementToBeClickable(By.XPath("//*[@id='mainfooter']/div[4]/a")));

driver.FindElement(By.XPath("//*[@id='mainfooter']/div[4]/a")).Click();

Console.ReadKey();

}
}
}

Let me know, when you get a chance.

Thanks,
Shobha

G
gunjan Replied on 20/12/2018

Scroll down the webpage and check again.


S
shobha bandaru Replied on 24/12/2018

good thing is I am able to scroll down but element is not identified --
getting the following error OpenQA.Selenium.WebDriverException: 'Error executing JavaScript' at this line
js.ExecuteScript("document.getElementBytitle('Aspire Media Group').Click"); 

Attachedthecode


G
gunjan Replied on 25/12/2018

Hi Shobha,
Try to inspect the element with selenium not with js


S
shobha bandaru Replied on 27/12/2018

I tried with Selenium also, no luck.
Attaching the code here


G
gunjan Replied on 27/12/2018

The same code is working fine in my system
IWebDriver driver = new ChromeDriver();
driver.Manage().Window.Maximize();
driver.Navigate().GoToUrl("https://www.jobserve.com/us/en/Job-Search/");

driver.FindElement(By.XPath("//*[@id='mainfooter']/div[4]/a")).Click();

Please check once again.