I am trying to locate an element that has the following line in the chrome inspect code, <href="app/arp/home/profile">.
My line is:
driver.find_element(By.xpath("//a[@href='/app/arp/home/profile']")).click()
But I get the following error:
AttributeError: type object 'By' has no attribute 'xpath'
What is wrong?
Till Selenium v3.141.0 to locate an element using xpath you can use the following syntax:
However, in the upcoming releases
find_element_by_*commands will be deprecatedFrom Selenium v4.x onwards the effective syntax will be:
An example:
Code Block:
Console Output: