XPATH counts from 1
Python counts from 0
Differnece between signle '/' or double '//':
Single slash '/' anywhere in xpath signifies to look for the element immediately inside the parent element.
Double slash '//' signifies to look for any child or nested-child element inside the parent element.
Using Text of the element to build xpath:
//div[@class='homepage-hero']//a[text()='Enroll now']
Using contains to find the elements:
//div[@id='navbar']//a[contains(@class,'navbar-link') and contains(@href,'sign_in')]
Using Starts-With to find the elements:
//div[@id='navbar']//a[starts-with(@class,'navbar-link')]
Parent/Preceding Sibling/Following Sibling
//parent::<tag>
//preceding-sibling::<tag>
//following-sibling::<tag>