String wb = driver.findElement(By.xpath("//div[@class='gb_h gb_i']/a")).getAttribute('href');
Above code gives error Invalid character constant
I want to fetch href
from html code using java
String wb = driver.findElement(By.xpath("//div[@class='gb_h gb_i']/a")).getAttribute('href');
Above code gives error Invalid character constant
I want to fetch href
from html code using java
Copyright © 2021 Jogjafile Inc.
You should change
getAttribute('href')
togetAttribute("href")
so it should beString wb = driver.findElement(By.xpath("//div[@class='gb_h gb_i']/a")).getAttribute("href");
getAttribute()
method receivesString
.In Java
String
is defined by" "
whileCharacter
is defined by' '