Can we read the text 'Testing123' using xpath? - selenium-webdriver

I tried with "//div[#id='workcenterhtml']//descendant::a" , but cant read the text using getText()

you should try "//div[#id='workcenterhtml']//descendant::a/text()"

Related

Google Data Studio - Extract text after character ? using regex

I am trying to create a calculated field in Data Studio using regex formula. I would like to extract text after a character ? in the page url. Below is the data input and the expected output
Input
Output
example.com/solutions?search=reg
search=reg
example.com/solutions?sort_field_name=visits_count&sort_direction=desc&category=Advanced+Patient+Scheduling
sort_field_name=visits_count&sort_direction=desc&category=Advanced+Patient+Scheduling
example.com/categories/c2a3dd33-4b3d-4a01-955f-faee81abc871?tab=resources
tab=resources
example.com/solutions
null
I tried following and can't seem to get it to work in Data Studio. But this works here: https://regex101.com/r/k5CRjN/1
REGEXP_EXTRACT(Full page URL,'[^?]+$')
I also tried escaping special character but still doesn't work
can you try:
REGEXP_EXTRACT([FIELD NAME],'\\?(.*)$')

Need to find complete text of an HTML paragraph

enter image description here
I am trying to get text wrapped in paragraph , below this div node.
I tried using this - I am getting Null value
driver.findElement(By.id("popoverContent")).getText()
using this also give me null:
driver.findElement(By.id("popoverContent")).getAttribute("innerhtml")
Please help

Not able to get text value from tag

Can anyone tell, how to get text fightname(Spicejet) as a string?
Tried code but giving me blank value
WebElement flightname= driver.findElement(By.xpath("//div[#class='top_first_part clearfix']/div[2]/span[1]")).getText();
also tried with javascript also but it giving me null value
Thanks in advance!!!
Url - https://flights.makemytrip.com/makemytrip/search/O/O/E/1/0/0/S/V0/DEL_BOM_08-08-2017?contains=false&remove=
Image of tag FYI
The xpath you were using was not able to uniquely identify the container for first flight name. Try following:
WebElement flightname= driver.findElement(By.xpath("//div[starts-with(#class, 'clearfix listing_row')][1]//div[#class='top_first_part clearfix']//span[#class='pull-left airline_info_detls']/span[1]")).getText();
Let me know, whether it works for you.
WebElement Name=driver.findElement(By.xpath(".//*[#id='content']/div/div[2]/div[4]/div[2]/div[5]/div/div[1]/div[1]/span[1]/span[2]/span[1]"));
String flightName= Name.getText();
System.out.println(flightName);
Try this code it is working fine, I guess your xpath is wrong, it does not locate any Node. So try this. I hope it works for You.
driver.get("http://flights.makemytrip.com/makemytrip/search/O/O/E/1/0/0/S/V0/DEL_BOM_08-08-2017?contains=false&remove=");
WebElement Name= driver.findElement(By.xpath(".//[#id='content']/div/div[2]/div[4]/div[2]/div[5]/div/div[1]/div[1]/span[1]/span[2]/span[1]"));
String flightName= Name.getText();
System.out.println(flightName);

Using $scope with $parse

I want to find the value of a parsed text in angular.
For example:
I know i can set the scope value of a variable text like following
var text = 'randomString';
$parse(text).assign($scope, 1234);
But i do not need to set the value. Instead i want to retrieve it. I tried console.log($parse('randomString')), but it prints out a function. I tried console.log($scope.$parse('randomString')), but it throws an error saying it is not a function.
I know i can use $scope.randomString in the above example but i need the string to be dynamic so i do not know what the string will actually be
How can i retrieve the value?
Okay so I came across a solution online. I used:
console.log($scope.$eval('randomString'));

CSV file formatting problem

there's column value which is 1-6, wherein CSV does auto-format and displays the same as 6-JAN. Any solution to overcome this please?
Thanks,
Seetharaman.
Is it possible to use a text-delimiter such as quotes, i.e. "1-6"
It doesn't depend on the file format your using but on the program that writes and saves the file. So which program are you using for editing the csv file?
Have you tried to format the cells to Text?

Resources